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

29747 Коммитов

Автор 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
John McCall b44e0cf937 No, actually, we do need to be able to mangle substituted template names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134195 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 21:59:02 +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 0e3d76c8d7 svn propdel svn:eol-style test/Sema/return.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134169 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 16:49:43 +00:00
Peter Collingbourne d57b7ff9be Replace an unreachable error path with an assert
(SourceManager::createFileID cannot return an invalid file ID).
Also update a comment to reflect this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134168 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 16:41:03 +00:00
Peter Collingbourne a1a38741fd Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134167 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 16:40:50 +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
David Chisnall d3fc7296ae Add support for weakly imported classes (GNU runtime).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 10:14:37 +00:00
Abramo Bagnara bfbdcd861a Fixed enum constant evaluation assertions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134139 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 09:36:05 +00:00
Chandler Carruth ca0d0d4a0d Improve the wording of the warning when returning a value from
a constructor or destructor.

Patch by Hans Wennborg.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134138 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 08:56:22 +00:00
John McCall 146060435c Preserve that a TemplateName was arrived at by substituting
for a template template parameter.

Uses to follow.

I've also made the uniquing of SubstTemplateTemplateParmPacks
use a ContextualFoldingSet as a minor space efficiency.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 08:33:18 +00:00
Chandler Carruth a8581b9ca0 Fix an obvious typo in an attribute's diagnostics.
Patch by Caitlin Sadowski.

Unfortunately, this attribute doesn't seem to have a single test. It is
only mentioned in comments in one test, and as a string literal in
a copy of some Clang code checked in as a test for the Indexer. =[ It
dates from 2009 r74280 as part of OpenCL 1.0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134136 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 08:14:54 +00:00
Evan Cheng 368691e5ac createTargetMachine now takes a CPU string.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134128 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 02:06:32 +00:00
John McCall 1901dce8b1 Document and check tighter assumptions about the TemplateName of a
TemplateSpecializationType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134120 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 00:42:27 +00:00
Argyrios Kyrtzidis 5b3284a927 Introduce a caching mechanism for macro expanded tokens.
Previously macro expanded tokens were added to Preprocessor's bump allocator and never released,
even after the TokenLexer that were lexing them was finished, thus they were wasting memory.
A very "useful" boost library was causing clang to eat 1 GB just for the expanded macro tokens.

Introduce a special cache that works like a stack; a TokenLexer can add the macro expanded tokens
in the cache, and when it finishes, the tokens are removed from the end of the cache.

Now consumed memory by expanded tokens for that library is ~ 1.5 MB.

Part of rdar://9327049.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 22:20:11 +00:00
Argyrios Kyrtzidis 8ccac3de13 [libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at the appropriate place in CIndex.cpp
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 22:20:07 +00:00
Argyrios Kyrtzidis c5c5e92ec5 Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 22:20:04 +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
Benjamin Kramer c3151c4328 Remove doxygen.cfg to prevent accidental commits, it is generated from doxygen.cfg.in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134072 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 16:22:39 +00:00
Bob Wilson 949fd1aa67 Use preferred 64-bit alignment for i64 & f64 for Thumb targets. Radar 9695134.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134070 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 16:09:20 +00:00
David Chisnall 95b135b5c6 Make ARC support default to true. Please can we stop making Objective-C runtime features part of the platform description? This only makes sense for Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134066 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 13:17:23 +00:00
David Chisnall c7aed3b9fb Add ARC support for the GNUstep runtime.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134065 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 13:16:41 +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
Evan Cheng 1df396d85d Revert accidental commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 01:23:25 +00:00
Evan Cheng 693769cafc SubtargetFeature.h has been moved to MC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134050 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-29 01:14:32 +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
Chandler Carruth 55620531eb Fix non-determinism in selecting between equal-length names which refer
to the same declaration when correcting typos. This is done by
essentially sorting the corrections as they're added.

Original patch by Kaelyn Uhrain, but modified for style and correctness
by accounting for more than just the textual spelling.

This still is a bit of a WIP hack to make this deterministic. Kaelyn
(and myself) are working on a more principled solution going forward.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134038 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 22:48:40 +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
Chandler Carruth 9af7e8e0cb Fix an invalid use of ::back() on an newly emptied vector. Also tighten
up several places where we never expect to have NULL pointers to assert
early.

This fixes a valgrind error within CorrectTypo, but not the
non-determinism.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 21:43:34 +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
Fariborz Jahanian bf9eb88792 Eliminate most uses of ShallowCollectObjCIvars which requires
a vector for collection. Use iterators where needed instead.
// rdar://6817577


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134015 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 18:05:25 +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 2ecc28a772 Dynamically allocate the StringMaps used in typo correction so that we
don't rely on the existence of a copy constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134009 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 16:44:39 +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 0b8c98f3dd Introduce Declarator::CXXNewContext and remove 'AutoAllowedInTypeName' parameter
from Sema::GetTypeForDeclarator. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133987 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 03:01:23 +00:00
Argyrios Kyrtzidis d3880f8458 Centralize all checks for a C++ tag definition inside a typename in
Sema::GetTypeForDeclarator and remove its 'OwnedDecl' out parameter.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133986 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 03:01:18 +00:00
Argyrios Kyrtzidis 3215398dc9 Centralize the check for a tag definition in a Declarator::PrototypeContext inside GetTypeForDeclarator.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133985 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28 03:01:15 +00:00