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

10983 Коммитов

Автор SHA1 Сообщение Дата
John McCall 35ee32e800 Just mangle substituted template parameter types as unresolved types.
This is kindof questionable but seems to do more-or-less the right thing.
This is not a particularly friendly part of the ABI.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134227 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 02:19:08 +00:00
Douglas Gregor 561f81243f Introduce the notion of instantiation dependence into Clang's AST. A
type/expression/template argument/etc. is instantiation-dependent if
it somehow involves a template parameter, even if it doesn't meet the
requirements for the more common kinds of dependence (dependent type,
type-dependent expression, value-dependent expression).

When we see an instantiation-dependent type, we know we always need to
perform substitution into that instantiation-dependent type. This
keeps us from short-circuiting evaluation in places where we
shouldn't, and lets us properly implement C++0x [temp.type]p2.

In theory, this would also allow us to properly mangle
instantiation-dependent-but-not-dependent decltype types per the
Itanium C++ ABI, but we aren't quite there because we still mangle
based on the canonical type in cases like, e.g.,

  template<unsigned> struct A { };
  template<typename T>
    void f(A<sizeof(sizeof(decltype(T() + T())))>) { }
  template void f<int>(A<sizeof(sizeof(int))>);

and therefore get the wrong answer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134225 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 01:22:09 +00:00
John McCall 68a51a7f9c Change the mangling of enclosing template template parameters
that serve as the base template name of an unresolved-name to
be mangled as a substitution.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134213 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 00:04:39 +00:00
Hans Wennborg 935a70c1e7 Fix off-by-one error in StringLiteral::getLocationOfByte.
This fixes PR10223.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134183 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 20:17:41 +00:00
Hans Wennborg 150fee8b2b Move test/Sema/return.cpp into test/SemaCXX/return.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134171 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 17:20:18 +00:00
John McCall ea4aba0e97 Perform lvalue-to-rvalue conversions on both operands of ->*
and the RHS of .*.  Noticed by Enea Zaffanella!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134170 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 17:15:34 +00:00
Hans Wennborg 62273f91b6 Test for errors for returning a value from a ctor or dtor.
This fell out when Chandler landed the patch in r134138.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134163 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 15:48:23 +00:00
Douglas Gregor 54001c1e6a Check for deprecated/unavailable/etc attributes on fields that are
initialized via initializer lists. Fixes <rdar://problem/9694686>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134099 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 21:51:31 +00:00
Douglas Gregor e12a11f26b When redeclaring a local extern in the same scope, make sure that we
replace the existing declaration appropriately. Patch by Jordy Rose,
fixes PR10013 / <rdar://problem/9584157>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134097 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 21:22:02 +00:00
Fariborz Jahanian 8fefc8e245 objc-arc: fix a IRGen crash when checking for
accessibility of an initializer which is a compound 
statement. // rdar://9694706


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134091 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 20:00:16 +00:00
Fariborz Jahanian 5d9b6bf9de Use existing -fcatch-undefined-behavior option,
replacing -freset-local-blocks. // rdar://9227352


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134082 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 18:41:17 +00:00
Eli Friedman ded137fcab We don't pass classes with a copy-constructor or destructor byval, so the address takes up an integer register (if one is available). Make sure the x86-64 ABI implementation takes that into account properly.
The fixed implementation is compatible with the implementation both gcc and llvm-gcc use.

rdar://9686430 . (This is the issue that was reported in the thread "[LLVMdev] Segfault calling LLVM libs from a clang-compiled executable".)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134059 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 07:04:55 +00:00
Fariborz Jahanian 1077e420b8 Under a compiler flag, -freset-local-blocks,
wipe out stack blocks when they go out of scope.
// rdar://9227352


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134045 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 23:51:26 +00:00
Daniel Dunbar d6a4d18f52 Revert r133024, "[format strings] correctly suggest correct type for '%@'
specifiers.  Fixes <rdar://problem/9607158>." because it causes false positives
on some code that uses CF toll free bridging.
 - I'll let Doug or Ted figure out the right fix here, possibly just to accept
   any pointer type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134041 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 23:33:55 +00:00
Chandler Carruth be098b32bf Update this test to reflect the new (deterministic) order in r134038.
This was part of Kaelyn's original patch that got dropped while I was
working on it, but after I ran my tests. =/ Sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134039 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 22:58:10 +00:00
Chad Rosier ea76d8a996 Modify test case to allow buildbots to make forward progress. This test should
now (incorrectly) pass.  Once the appropriate fixes have been made this test
should be reverted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134035 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 22:29:53 +00:00
Daniel Dunbar 99ca47b21f Driver/Darwin: -force_load can be specified multiple times.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134025 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 20:16:02 +00:00
Eric Christopher de31fd7eee Split out logic for valid clobbers and valid inline asm registers.
Fixes rdar://9281377


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134016 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 18:20:53 +00:00
John McCall d3d49bb27c Be more thorough about mangling unresolved types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134011 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 16:49:23 +00:00
Douglas Gregor d8bba9c152 Add support for C++ namespace-aware typo correction, e.g., correcting
vector<int>

to

  std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134007 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 16:20:02 +00:00
Douglas Gregor 020540b740 Fix test case; we may end up linking against the libprofile_rt dylib.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134006 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 15:40:31 +00:00
Jordy Rose 0fa6bf7f02 [analyzer] strnlen isn't a builtin, don't test for it
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133994 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 05:34:40 +00:00
Chris Lattner 83068315f7 Fix PR9279 - Macro expansion stack trace seriously broken with function-style macros, by not recursively printing notes for other 'instantiated from' notes.
This is a one line fix here:
+      // Don't print recursive instantiation notes from an instantiation note.
+      Loc = SM.getSpellingLoc(Loc);

While here, fix the testcase to be more precise (it got filecheck'ized
brutally), and fix EmitCaretDiagnostic to be private and to not pass down
the unused 'Level' argument.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133993 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 05:11:33 +00:00
Argyrios Kyrtzidis db7abf78de Remove the call to GetTypeForDeclarator in Sema::ActOnCXXConditionDeclaration.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133984 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 03:01:12 +00:00
Argyrios Kyrtzidis 2ba68b2964 Cut down a few of the excess errors in the test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133983 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 03:01:09 +00:00
Fariborz Jahanian 6326e05fe8 Provide fix-it for '.' <-> '->' for Objective-C ivar/property access.
// rdar://7811841


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 00:00:52 +00:00
John McCall c03fa498b9 ARC writeback isn't supposed to apply to local indirect pointers,
only to pointers to locals.  But it should work inside blocks, too.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 23:59:58 +00:00
John McCall 6ce51ee94b Don't factor in visibility for templates and template arguments
for explicit specializations with their own explicit visibility.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133958 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 23:06:04 +00:00
John McCall a0b7d2ed23 Merge this test into another.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133957 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 22:57:05 +00:00
John McCall 239cad79cb Update test for r133934.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133942 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 21:23:26 +00:00
Fariborz Jahanian 68fe96adf7 Handle nonnull attribute with optional argument number on
functions with arguments of transparent unions type.
// rdar://9584012


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133941 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 21:12:03 +00:00
Jordy Rose eda368791b [analyzer] Use UnknownVal when default-initializing arrays whose element types we don't model, to distinguish them from uninitialized arrays (PR10163).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133937 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 20:36:38 +00:00
Nico Weber 9d11e6f475 Revert parts of r133860 to fix a crash. Add a test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133931 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 19:46:54 +00:00
Argyrios Kyrtzidis 064c44b8a1 [libclang] Avoid having the cursor of an expression replace the declaration cursor
when the expression source range overlaps the declaration range.

This can happen for C++ constructor expressions whose range generally
include the variable declaration, e.g.:

  MyCXXClass foo; // Make sure pointing at 'foo' returns a VarDecl cursor.

rdar://9124499.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133930 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 19:42:23 +00:00
Argyrios Kyrtzidis 5517b89953 [libclang] Avoid having the cursor of an expression "overwrite" the annotation of the
variable declaration that it belongs to.

This can happen for C++ constructor expressions whose range generally
include the variable declaration, e.g.:

  MyCXXClass foo; // Make sure we don't annotate 'foo' as a CallExpr cursor.

rdar://9124499.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133929 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 19:42:20 +00:00
Douglas Gregor d0e8b78278 When instantiating a C++ "new" expression, don't fake source locations
for the '(' and ')' around the initializer unless we actually have an
initializer. Fixes PR10197, an issue where we were value-initializing
rather than default-initializing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133913 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 16:55:54 +00:00
Chandler Carruth 6628969c3e Cleanup a fixme by using a specific diagnostic for subscripting
a pointer to void.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133912 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 16:32:27 +00:00
Chandler Carruth ae19806d2c Fix missing braces around two statements that were intended to be part
of a single if block. This is really annoying to track down and test.
Silly changes to the test case caused it to stop showing up. I wish
there were a more concrete way of asserting that a note attaches to the
intended diagnostic.

This fixes PR10195.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 08:31:58 +00:00
Chandler Carruth 13b21be065 Factor out (some of) the checking for invalid forms of pointer
arithmetic into a couple of common routines. Use these to make the
messages more consistent in the various contexts, especially in terms of
consistently diagnosing binary operators with invalid types on both the
left- and right-hand side. Also, improve the grammar and wording of the
messages some, handling both two pointers and two (different) types.

The wording of function pointer arithmetic diagnostics still strikes me
as poorly phrased, and I worry this makes them slightly more awkward if
more consistent. I'm hoping to fix that with a follow-on patch and test
case that will also make them more helpful when a typedef or template
type parameter makes the type completely opaque.

Suggestions on better wording are very welcome, thanks to Richard Smith
for some initial help on that front.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133906 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 08:02:19 +00:00
Richard Smith 2ced044c34 Fix PR10187: when diagnosing a two-phase-lookup-related failure, don't assert that any names we find are valid candidates for the call.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133898 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-26 22:19:54 +00:00
Richard Smith 1ab0d90af4 Fix a couple more issues related to r133854:
When performing semantic analysis on a member declaration, fix the check for whether we are declaring a function to check for parenthesized declarators, declaration via decltype, etc.

Also fix the semantic check to not treat FuncType* as a function type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133862 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-25 02:28:38 +00:00
John McCall df7b091c58 Do not apply the ARC move optimization to 'const'-qualified xvalues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-25 02:26:44 +00:00
John McCall 913dab2525 Mark the multiply which occurs as part of performing pointer
arithmetic on a VLA as 'nsw', per discussion with djg, and
implement pointer arithmetic (other than array accesses) and
pointer subtraction for VLA types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133855 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-25 01:32:37 +00:00
Douglas Gregor 555f57e354 When deciding how to parse "= something" as part of a member
declaration, determine whether the declaration will end up declaring a
function using semantic criteria (e.g., it will have function type)
rather than purely syntactic criteria (e.g., it has the form of a
function declarator). Fixes <rdar://problem/9670557>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133854 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-25 00:56:27 +00:00
Fariborz Jahanian 831fb96225 objc-arc/mrc: Allow ns_returns_not_retained attribute on properties
to turn off warning on those properties which follow Cocoa naming
convention for retaining objects and yet they were not meant for
such purposes. Also, perform consistancy checking for declared
getters of such methods. // rdar://9636091



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133849 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-25 00:17:46 +00:00
John McCall 88c1dfccf8 Two more test cases which have been long uncommitted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133842 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 23:30:52 +00:00
John McCall 4027f09736 Test case for r133840, neglectfully uncommitted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133841 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 23:29:50 +00:00
Devang Patel 1d323e0482 Fix struct member's scope. Patch by Xi Wang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133829 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 22:00:59 +00:00
John McCall bc8d40d85f Change the IR-generation of VLAs so that we capture bounds,
not sizes;  so that we use well-typed allocas;  and so that we
properly recurse through the full set of variably-modified types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133827 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 21:55:10 +00:00
Fariborz Jahanian 327126ee3d No need to warn if 'unavailable' method/property
is not implemented. // rdar://9651605


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133819 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24 20:31:37 +00:00