Граф коммитов

1987 Коммитов

Автор SHA1 Сообщение Дата
Manman Ren 63fd408a61 Exploit this-return of a callsite in a this-return function.
For constructors/desctructors that return 'this', if there exists a callsite
that returns 'this' and is immediately before the return instruction, make
sure we are using the return value from the callsite.

We don't need to keep 'this' alive through the callsite. It also enables
optimizations in the backend, such as tail call optimization.

Updated from r177211.
rdar://12818789


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177541 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20 16:59:38 +00:00
David Blaikie c4b580b593 Make front-end debug info namespace test frontend-only & more specific without overconstraining it
The backend portion of this test will be committed to LLVM's test suite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177485 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20 05:12:06 +00:00
Nick Lewycky f2b5e07072 Make clang emit linkage names in debug info for subprograms when coverage info
is enabled. Also add a new -test-coverage cc1 flag which makes testing coverage
possible and add our first clang-side coverage test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177470 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20 01:38:16 +00:00
David Blaikie 8a40cc6f9c Simplify/generalize some debug info test cases
Mostly, try to depend on the annotation comments more so these tests are more
legible, brief, and agnostic to schema changes in the future (sure, they're not
agnostic to changes to the comment annotations but since they're easier to read
they should be easier to update if that happens).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177457 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19 23:10:14 +00:00
Adrian Prantl fd44d34ab6 Relax test to allow for attributes on other architectures. Caught by powerpc64-unknown-linux-gnu buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177419 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19 18:20:35 +00:00
Rafael Espindola 9a2f5d70df Don't try to set attributes in alias, they have none.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177402 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19 15:03:47 +00:00
Richard Smith c7f811638f Add missing diagnostic for a nested-name-specifier on a free-standing type definition. Bump some related diagnostics from warning to extension in C++, since they're errors there. Add some missing checks for function specifiers on non-function declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177335 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18 22:52:47 +00:00
Richard Smith 07b0fdcee8 Bring inheriting constructor implementation up-to-date with current defect
reports, and implement implicit definition of inheriting constructors.
Remaining missing features: inheriting constructor templates, implicit
exception specifications for inheriting constructors, inheriting constructors
from dependent bases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177320 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18 21:12:30 +00:00
David Blaikie 367989b354 Generalize a few debug info test cases
Checking for the annotation comment rather than the metadata values makes these
tests resilient to a coming refactor that will pull these fields out into a
separate metadata node.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177237 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-17 20:29:22 +00:00
Manman Ren 7cd84baa53 revert r177211 due to its potential issues
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177222 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16 04:47:38 +00:00
Manman Ren 2710ed8fd9 Exploit this-return of a callsite in a this-return function.
For constructors/desctructors that return 'this', if there exists a callsite
that returns 'this' and is immediately before the return instruction, make
sure we are using the return value from the callsite.

We don't need to keep 'this' alive through the callsite. It also enables
optimizations in the backend, such as tail call optimization.

rdar://12818789


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16 00:11:09 +00:00
Adrian Prantl 6b6a9b3f7b Force column info only for direct inlined functions. This should strike
the balance between expected behavior and compatibility with the gdb
testsuite.
(GDB gets confused if we break an expression into multiple debug
stmts so we enable this behavior only for inlined functions. For the
full experience people can still use -gcolumn-info.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15 17:09:05 +00:00
Adrian Prantl 836e7c9357 Allocate stack storage for .block_descriptor and captured self at -O0.
This way the register allocator will not optimize away the debug info
for captured variables.

Fixes rdar://problem/12767564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177086 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 17:53:33 +00:00
Adrian Prantl b38b3cd64c relax check to allow for attributes (fix buildbot for elf-ppc64)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176954 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-13 16:14:44 +00:00
Adrian Prantl 5ca58a0aca Eliminate backend dependency in CFE testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176901 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12 21:40:00 +00:00
Adrian Prantl 00df5eaa9f Force column info to be generated for call expressions so we can
differentiate multiple inlined call sites on the same line
in the debug info.

Fixes rdar://problem/13036237

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176895 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12 20:43:25 +00:00
Rafael Espindola 77e430df03 Correctly compute linkage of decls forward declared extern C.
This fixes a crash in

namespace {
  struct X {};
}
extern "C" X test2_b;
X test2_b

before we would assign different linkages to each of the test2_b decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176869 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12 15:22:39 +00:00
Rafael Espindola 6c18af2445 Remove a bogus assert so we don't crash in
namespace {
  struct X {};
}
extern "C" {
  X b = X();
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176866 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-12 15:06:22 +00:00
Lang Hames 23742cd8c6 Use ASTContext::getDeclAlign(<Field Decl>) to get the alignment of the first
field to be memcpy'd, rather instead of ASTContext::getTypeAlign(<Field Type>).
For packed structs the alignment of a field may be less than the alignment of
the field's type.

<rdar://problem/13338585>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176512 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 20:27:24 +00:00
Richard Smith 3c5cd15da5 Don't emit calls to virtual [[noreturn]] functions as noreturn; overrides of a
[[noreturn]] function are not required to also be [[noreturn]]. We still emit
calls to virtual __attribute__((noreturn)) functions as noreturn; unlike GCC,
we do require overriders to also be noreturn for that attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176476 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-05 08:30:04 +00:00
John McCall 0353a7b2df Fix the emission of the copy-initialization of a block capture
from a lambda capture when the capture is not trivially-copyable.

rdar://13295759

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176431 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-04 06:32:36 +00:00
Bill Wendling be9e8bfef6 Add more of the command line options as attribute flags.
These can be easily queried by the back-end.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176304 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 22:49:57 +00:00
John McCall bd7370a786 Use the actual ABI-determined C calling convention for runtime
calls and declarations.

LLVM has a default CC determined by the target triple.  This is
not always the actual default CC for the ABI we've been asked to
target, and so we sometimes find ourselves annotating all user
functions with an explicit calling convention.  Since these
calling conventions usually agree for the simple set of argument
types passed to most runtime functions, using the LLVM-default CC
in principle has no effect.  However, the LLVM optimizer goes
into histrionics if it sees this kind of formal CC mismatch,
since it has no concept of CC compatibility.  Therefore, if this
module happens to define the "runtime" function, or got LTO'ed
with such a definition, we can miscompile;  so it's quite
important to get this right.

Defining runtime functions locally is quite common in embedded
applications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176286 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-28 19:01:20 +00:00
Timur Iskhodzhanov 1d4fff5551 Better support for constructors with -cxx-abi microsoft, partly fixes PR12784
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176186 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 13:46:31 +00:00
Rafael Espindola a2bb892333 Don't cache the visibility of types.
Since r175326 an implicitly hidden template argument can cause a template
installation to become hidden, even if the template itself has an explicit
default visibility. This requires that we keep track of "late" additions
of the visibility attribute.

This is hopefully the last followup change. It just removes the caching of
visibilities from types so that we can see new attributes even after a type has
been used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 04:15:01 +00:00
Lang Hames 5e8577ece7 Use the correct alignment for POD-member memcpys where the first field is a
bitfield. CGBitField::StorageAlignment holds the alignment in chars, but
emitMemcpy had been treating it as if it were held in bits, leading to
underaligned memcpys.

Related to PR15348.

Thanks very much to Chandler for the diagnosis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176163 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 04:14:49 +00:00
Bill Wendling 8992457927 Reapply r176133 with testcase fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176145 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-27 00:06:04 +00:00
Rafael Espindola b58f810669 Use existing macros to simplify the test a bit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176138 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 23:24:59 +00:00
Rafael Espindola d3b2f0ac1c Use the most recent decl in getExplicitVisibility.
Now that implicitly hidden template arguments can make an instantiation hidden,
it is important to look at more than just the canonical decl of the argument
in order to see if an attribute is available in a more recent decl.

This has the disadvantage of exposing when getExplicitVisibility is called,
but lets us handle cases like

template <typename T>
struct __attribute__((visibility("default"))) barT {
  static void zed() {}
};
class foo;
class __attribute__((visibility("default"))) foo;
template struct barT<foo>;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176112 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 19:33:14 +00:00
Rafael Espindola d7a60ad800 Be more careful in applying pragma weak. Fixes pr14974.
GCC applies a pragma weak to a decl if it matches the mangled name. We used
to apply if it matched the plain name.

This patch is a compromise: we apply the pragma only if it matches the name
and the decl has C language linkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176110 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 19:13:56 +00:00
Will Dietz bb60fc6a71 [ubsan] Emit single check for left shift.
Avoids warning twice on same shift.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176056 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 22:37:49 +00:00
Anna Zaks c283311102 Revert "Add more attributes from the command line to functions."
This reverts commit 176009.

The commit is a likely cause of several buildbot failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 19:51:03 +00:00
Bill Wendling d620e09c13 Add more attributes from the command line to functions.
This is an ongoing process. Any command line option which a back-end cares about
should be added here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176009 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 07:15:16 +00:00
Richard Smith 5956bcc31a PR15338: Don't assert if -fsanitize=bounds sees array indexing on an incomplete
array type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175982 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 01:56:24 +00:00
Richard Smith a0a628f839 ubsan: Emit bounds checks for array indexing, vector indexing, and (in really simple cases) pointer arithmetic. This augments the existing bounds checking with language-level array bounds information.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175949 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-23 02:53:19 +00:00
Rafael Espindola 02fb50d540 Remove the hack that avoided mangling static functions in extern C contexts.
Weather we should give C language linkage to functions and variables with
internal linkage probably depends on how much code assumes it. The standard
says they should have no language linkage, but gcc and msvc assign them
C language linkage.

This commit removes the hack that was preventing the mangling on static
functions declare in extern C contexts. It is an experiment to see if we
can implement the rules in the standard.

If it turns out that many users depend on these functions and variables
having C language linkage, we should change isExternC instead and try
to convince the CWG to change the standard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175937 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-23 00:26:28 +00:00
Bill Wendling 5bb033ba5d Update tests so that we don't test for function-only attributes on call sites.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175921 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 21:12:51 +00:00
Bill Wendling 4e1125f630 Update to use references to attribute groups instead of listing the attributes on the call/invoke instructions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175878 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-22 09:10:20 +00:00
John McCall 3892d022f3 Ignore visibility from enclosing template arguments
for explicit member specializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175827 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 23:42:58 +00:00
Bill Wendling 3bba3efba0 Attempt to clean up tests for non-X86 platforms.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175652 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 19:30:01 +00:00
Bill Wendling f7a9da053f Modify the tests to use attribute group references instead of listing the
function attributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175606 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 07:22:19 +00:00
John McCall d4c3d66be7 Add a new 'type_visibility' attribute to allow users to
control the visibility of a type for the purposes of RTTI
and template argument restrictions independently of how
visibility propagates to its non-type member declarations.

Also fix r175326 to not ignore template argument visibility
on a template explicit instantiation when a member has
an explicit attribute but the instantiation does not.

The type_visibility work is rdar://11880378

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-20 01:54:26 +00:00
Timur Iskhodzhanov aad3fa6619 Add the missing 'static' keyword to the test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175502 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19 10:50:44 +00:00
John McCall a880b19aa6 Add support for -fvisibility-ms-compat.
We treat this as an alternative to -fvisibility=<?>
which changes the default value visibility to "hidden"
and the default type visibility to "default".

Expose a -cc1 option for changing the default type
visibility, repurposing -fvisibility as the default
value visibility option (also setting type visibility
from it in the absence of a specific option).

rdar://13079314

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175480 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19 01:57:35 +00:00
Lang Hames e95036b2f5 Remove block names from test case to unbreak release builds.
Thanks Chandler. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175392 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-17 10:18:28 +00:00
Lang Hames 56c00c4868 Re-apply r174919 - smarter copy/move assignment/construction, with fixes for
bitfield related issues.

The original commit broke Takumi's builder. The bug was caused by bitfield sizes
being determined by their underlying type, rather than the field info. A similar
issue with bitfield alignments showed up on closer testing. Both have been fixed
in this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175389 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-17 07:22:09 +00:00
Richard Smith b4127a28a6 Emit vtables for an extern template class as available_externally, not as
linkonce_odr. Emit construction vtables as internal in this case, since the ABI
does not guarantee that they will be availble externally.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175330 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-16 00:51:21 +00:00
John McCall 5a758de93f Rework the visibility computation algorithm in preparation
for distinguishing type vs. value visibility.

The changes to the visibility of explicit specializations
are intentional.  The change to the "ugly" test case is
a consequence of a sensible implementation, and I am happy
to argue that this is better behavior.  Other changes may
or may not be intended;  it is quite difficult to divine
intent from some of the code I altered.

I've left behind a comment which I hope explains the
philosophy behind visibility computation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175326 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-16 00:17:33 +00:00
Bill Wendling c0dcc2d7be Add the 'target-cpu' and 'target-features' attributes to functions.
The back-end will use these values to reconfigure code generation for different
features.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175308 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15 21:30:01 +00:00
Timur Iskhodzhanov 0f9827f5d6 Abstract out emitting the vdtor calls and do it properly when using -cxx-abi microsoft; also fix vdtor calls for the ARM ABI
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175271 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15 14:45:22 +00:00