]> granicus.if.org Git - clang/log
clang
13 years agoFix off-by-one error in StringLiteral::getLocationOfByte.
Hans Wennborg [Thu, 30 Jun 2011 20:17:41 +0000 (20:17 +0000)]
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

13 years agoMove test/Sema/return.cpp into test/SemaCXX/return.cpp
Hans Wennborg [Thu, 30 Jun 2011 17:20:18 +0000 (17:20 +0000)]
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

13 years agoPerform lvalue-to-rvalue conversions on both operands of ->*
John McCall [Thu, 30 Jun 2011 17:15:34 +0000 (17:15 +0000)]
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

13 years agosvn propdel svn:eol-style test/Sema/return.cpp
Hans Wennborg [Thu, 30 Jun 2011 16:49:43 +0000 (16:49 +0000)]
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

13 years agoReplace an unreachable error path with an assert
Peter Collingbourne [Thu, 30 Jun 2011 16:41:03 +0000 (16:41 +0000)]
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

13 years agoFix typo
Peter Collingbourne [Thu, 30 Jun 2011 16:40:50 +0000 (16:40 +0000)]
Fix typo

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134167 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTest for errors for returning a value from a ctor or dtor.
Hans Wennborg [Thu, 30 Jun 2011 15:48:23 +0000 (15:48 +0000)]
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

13 years agoAdd support for weakly imported classes (GNU runtime).
David Chisnall [Thu, 30 Jun 2011 10:14:37 +0000 (10:14 +0000)]
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

13 years agoFixed enum constant evaluation assertions.
Abramo Bagnara [Thu, 30 Jun 2011 09:36:05 +0000 (09:36 +0000)]
Fixed enum constant evaluation assertions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134139 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove the wording of the warning when returning a value from
Chandler Carruth [Thu, 30 Jun 2011 08:56:22 +0000 (08:56 +0000)]
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

13 years agoPreserve that a TemplateName was arrived at by substituting
John McCall [Thu, 30 Jun 2011 08:33:18 +0000 (08:33 +0000)]
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

13 years agoFix an obvious typo in an attribute's diagnostics.
Chandler Carruth [Thu, 30 Jun 2011 08:14:54 +0000 (08:14 +0000)]
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

13 years agocreateTargetMachine now takes a CPU string.
Evan Cheng [Thu, 30 Jun 2011 02:06:32 +0000 (02:06 +0000)]
createTargetMachine now takes a CPU string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134128 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDocument and check tighter assumptions about the TemplateName of a
John McCall [Thu, 30 Jun 2011 00:42:27 +0000 (00:42 +0000)]
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

13 years agoIntroduce a caching mechanism for macro expanded tokens.
Argyrios Kyrtzidis [Wed, 29 Jun 2011 22:20:11 +0000 (22:20 +0000)]
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

13 years ago[libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at...
Argyrios Kyrtzidis [Wed, 29 Jun 2011 22:20:07 +0000 (22:20 +0000)]
[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

13 years agoIntroduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality...
Argyrios Kyrtzidis [Wed, 29 Jun 2011 22:20:04 +0000 (22:20 +0000)]
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

13 years agoCheck for deprecated/unavailable/etc attributes on fields that are
Douglas Gregor [Wed, 29 Jun 2011 21:51:31 +0000 (21:51 +0000)]
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

13 years agoWhen redeclaring a local extern in the same scope, make sure that we
Douglas Gregor [Wed, 29 Jun 2011 21:22:02 +0000 (21:22 +0000)]
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

13 years agoobjc-arc: fix a IRGen crash when checking for
Fariborz Jahanian [Wed, 29 Jun 2011 20:00:16 +0000 (20:00 +0000)]
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

13 years agoUse existing -fcatch-undefined-behavior option,
Fariborz Jahanian [Wed, 29 Jun 2011 18:41:17 +0000 (18:41 +0000)]
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

13 years agoRemove doxygen.cfg to prevent accidental commits, it is generated from doxygen.cfg.in.
Benjamin Kramer [Wed, 29 Jun 2011 16:22:39 +0000 (16:22 +0000)]
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

13 years agoUse preferred 64-bit alignment for i64 & f64 for Thumb targets. Radar 9695134.
Bob Wilson [Wed, 29 Jun 2011 16:09:20 +0000 (16:09 +0000)]
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

13 years agoMake ARC support default to true. Please can we stop making Objective-C runtime...
David Chisnall [Wed, 29 Jun 2011 13:17:23 +0000 (13:17 +0000)]
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

13 years agoAdd ARC support for the GNUstep runtime.
David Chisnall [Wed, 29 Jun 2011 13:16:41 +0000 (13:16 +0000)]
Add ARC support for the GNUstep runtime.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134065 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWe don't pass classes with a copy-constructor or destructor byval, so the address...
Eli Friedman [Wed, 29 Jun 2011 07:04:55 +0000 (07:04 +0000)]
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

13 years agoRevert accidental commit.
Evan Cheng [Wed, 29 Jun 2011 01:23:25 +0000 (01:23 +0000)]
Revert accidental commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134052 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSubtargetFeature.h has been moved to MC.
Evan Cheng [Wed, 29 Jun 2011 01:14:32 +0000 (01:14 +0000)]
SubtargetFeature.h has been moved to MC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134050 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUnder a compiler flag, -freset-local-blocks,
Fariborz Jahanian [Tue, 28 Jun 2011 23:51:26 +0000 (23:51 +0000)]
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

13 years agoRevert r133024, "[format strings] correctly suggest correct type for '%@'
Daniel Dunbar [Tue, 28 Jun 2011 23:33:55 +0000 (23:33 +0000)]
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

13 years agoUpdate this test to reflect the new (deterministic) order in r134038.
Chandler Carruth [Tue, 28 Jun 2011 22:58:10 +0000 (22:58 +0000)]
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

13 years agoFix non-determinism in selecting between equal-length names which refer
Chandler Carruth [Tue, 28 Jun 2011 22:48:40 +0000 (22:48 +0000)]
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

13 years agoModify test case to allow buildbots to make forward progress. This test should
Chad Rosier [Tue, 28 Jun 2011 22:29:53 +0000 (22:29 +0000)]
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

13 years agoFix an invalid use of ::back() on an newly emptied vector. Also tighten
Chandler Carruth [Tue, 28 Jun 2011 21:43:34 +0000 (21:43 +0000)]
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

13 years agoDriver/Darwin: -force_load can be specified multiple times.
Daniel Dunbar [Tue, 28 Jun 2011 20:16:02 +0000 (20:16 +0000)]
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

13 years agoSplit out logic for valid clobbers and valid inline asm registers.
Eric Christopher [Tue, 28 Jun 2011 18:20:53 +0000 (18:20 +0000)]
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

13 years agoEliminate most uses of ShallowCollectObjCIvars which requires
Fariborz Jahanian [Tue, 28 Jun 2011 18:05:25 +0000 (18:05 +0000)]
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

13 years agoBe more thorough about mangling unresolved types.
John McCall [Tue, 28 Jun 2011 16:49:23 +0000 (16:49 +0000)]
Be more thorough about mangling unresolved types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134011 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDynamically allocate the StringMaps used in typo correction so that we
Douglas Gregor [Tue, 28 Jun 2011 16:44:39 +0000 (16:44 +0000)]
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

13 years agoAdd support for C++ namespace-aware typo correction, e.g., correcting
Douglas Gregor [Tue, 28 Jun 2011 16:20:02 +0000 (16:20 +0000)]
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

13 years agoFix test case; we may end up linking against the libprofile_rt dylib.
Douglas Gregor [Tue, 28 Jun 2011 15:40:31 +0000 (15:40 +0000)]
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

13 years ago[analyzer] strnlen isn't a builtin, don't test for it
Jordy Rose [Tue, 28 Jun 2011 05:34:40 +0000 (05:34 +0000)]
[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

13 years agoFix PR9279 - Macro expansion stack trace seriously broken with function-style macros...
Chris Lattner [Tue, 28 Jun 2011 05:11:33 +0000 (05:11 +0000)]
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

13 years agoIntroduce Declarator::CXXNewContext and remove 'AutoAllowedInTypeName' parameter
Argyrios Kyrtzidis [Tue, 28 Jun 2011 03:01:23 +0000 (03:01 +0000)]
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

13 years agoCentralize all checks for a C++ tag definition inside a typename in
Argyrios Kyrtzidis [Tue, 28 Jun 2011 03:01:18 +0000 (03:01 +0000)]
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

13 years agoCentralize the check for a tag definition in a Declarator::PrototypeContext inside...
Argyrios Kyrtzidis [Tue, 28 Jun 2011 03:01:15 +0000 (03:01 +0000)]
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

13 years agoRemove the call to GetTypeForDeclarator in Sema::ActOnCXXConditionDeclaration.
Argyrios Kyrtzidis [Tue, 28 Jun 2011 03:01:12 +0000 (03:01 +0000)]
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

13 years agoCut down a few of the excess errors in the test.
Argyrios Kyrtzidis [Tue, 28 Jun 2011 03:01:09 +0000 (03:01 +0000)]
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

13 years agoRevert unintentional commit.
Eli Friedman [Tue, 28 Jun 2011 00:03:31 +0000 (00:03 +0000)]
Revert unintentional commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133971 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoProvide fix-it for '.' <-> '->' for Objective-C ivar/property access.
Fariborz Jahanian [Tue, 28 Jun 2011 00:00:52 +0000 (00:00 +0000)]
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

13 years agoARC writeback isn't supposed to apply to local indirect pointers,
John McCall [Mon, 27 Jun 2011 23:59:58 +0000 (23:59 +0000)]
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

13 years agoMerge some calls to FoldingSetNodeID::AddInteger; assuming my measurements aren't...
Eli Friedman [Mon, 27 Jun 2011 23:58:21 +0000 (23:58 +0000)]
Merge some calls to FoldingSetNodeID::AddInteger; assuming my measurements aren't completely off, roughly a 1% speedup on SingleSource/UnitTests/ObjC/trivial-interface.m .

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133968 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't factor in visibility for templates and template arguments
John McCall [Mon, 27 Jun 2011 23:06:04 +0000 (23:06 +0000)]
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

13 years agoMerge this test into another.
John McCall [Mon, 27 Jun 2011 22:57:05 +0000 (22:57 +0000)]
Merge this test into another.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133957 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCache the result of AttributeList::getKind(); it's relatively expensive to compute...
Eli Friedman [Mon, 27 Jun 2011 21:53:17 +0000 (21:53 +0000)]
Cache the result of AttributeList::getKind(); it's relatively expensive to compute, and we query it frequently enough that it showed up in a profile.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133948 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix PR10204 in a better way.
John McCall [Mon, 27 Jun 2011 21:24:11 +0000 (21:24 +0000)]
Fix PR10204 in a better way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133943 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate test for r133934.
John McCall [Mon, 27 Jun 2011 21:23:26 +0000 (21:23 +0000)]
Update test for r133934.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133942 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHandle nonnull attribute with optional argument number on
Fariborz Jahanian [Mon, 27 Jun 2011 21:12:03 +0000 (21:12 +0000)]
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

13 years ago[analyzer] Use UnknownVal when default-initializing arrays whose element types we...
Jordy Rose [Mon, 27 Jun 2011 20:36:38 +0000 (20:36 +0000)]
[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

13 years agoMinor grammatical fix for error message. Radar 9681093.
Bob Wilson [Mon, 27 Jun 2011 20:25:49 +0000 (20:25 +0000)]
Minor grammatical fix for error message.  Radar 9681093.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133934 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert parts of r133860 to fix a crash. Add a test.
Nico Weber [Mon, 27 Jun 2011 19:46:54 +0000 (19:46 +0000)]
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

13 years ago[libclang] Avoid having the cursor of an expression replace the declaration cursor
Argyrios Kyrtzidis [Mon, 27 Jun 2011 19:42:23 +0000 (19:42 +0000)]
[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

13 years ago[libclang] Avoid having the cursor of an expression "overwrite" the annotation of the
Argyrios Kyrtzidis [Mon, 27 Jun 2011 19:42:20 +0000 (19:42 +0000)]
[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

13 years agolibprofile_rt may be installed as a dylib on Darwin.
Bill Wendling [Mon, 27 Jun 2011 19:15:03 +0000 (19:15 +0000)]
libprofile_rt may be installed as a dylib on Darwin.

If we cannot find the static library, use the dylib instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133926 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReduce the size of the ExtInfo bitfield in FunctionType from 9 bits
Douglas Gregor [Mon, 27 Jun 2011 18:45:19 +0000 (18:45 +0000)]
Reduce the size of the ExtInfo bitfield in FunctionType from 9 bits
down to 8 by restricting the maximum allowed regparm value to 6
(previously it was 7). I need the extra bit in Type to handle
instantiation-dependence.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133924 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen instantiating a C++ "new" expression, don't fake source locations
Douglas Gregor [Mon, 27 Jun 2011 16:55:54 +0000 (16:55 +0000)]
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

13 years agoCleanup a fixme by using a specific diagnostic for subscripting
Chandler Carruth [Mon, 27 Jun 2011 16:32:27 +0000 (16:32 +0000)]
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

13 years agoImprove header search for MinGW(-w64), from Ruben Van Boxem!
Douglas Gregor [Mon, 27 Jun 2011 15:47:15 +0000 (15:47 +0000)]
Improve header search for MinGW(-w64), from Ruben Van Boxem!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133911 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix missing braces around two statements that were intended to be part
Chandler Carruth [Mon, 27 Jun 2011 08:31:58 +0000 (08:31 +0000)]
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

13 years agoFactor out (some of) the checking for invalid forms of pointer
Chandler Carruth [Mon, 27 Jun 2011 08:02:19 +0000 (08:02 +0000)]
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

13 years agoFix PR10187: when diagnosing a two-phase-lookup-related failure, don't assert that...
Richard Smith [Sun, 26 Jun 2011 22:19:54 +0000 (22:19 +0000)]
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

13 years agoCleanup cast IRGen a bit; no intended functionality change.
Eli Friedman [Sat, 25 Jun 2011 02:58:47 +0000 (02:58 +0000)]
Cleanup cast IRGen a bit; no intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133864 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a couple more issues related to r133854:
Richard Smith [Sat, 25 Jun 2011 02:28:38 +0000 (02:28 +0000)]
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

13 years agoDo not apply the ARC move optimization to 'const'-qualified xvalues.
John McCall [Sat, 25 Jun 2011 02:26:44 +0000 (02:26 +0000)]
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

13 years agoLValue carries a type now, so simplify the main EmitLoad/Store APIs
John McCall [Sat, 25 Jun 2011 02:11:03 +0000 (02:11 +0000)]
LValue carries a type now, so simplify the main EmitLoad/Store APIs
by removing the redundant type parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133860 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMark the multiply which occurs as part of performing pointer
John McCall [Sat, 25 Jun 2011 01:32:37 +0000 (01:32 +0000)]
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

13 years agoWhen deciding how to parse "= something" as part of a member
Douglas Gregor [Sat, 25 Jun 2011 00:56:27 +0000 (00:56 +0000)]
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

13 years agoobjc-arc/mrc: Allow ns_returns_not_retained attribute on properties
Fariborz Jahanian [Sat, 25 Jun 2011 00:17:46 +0000 (00:17 +0000)]
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

13 years agoTwo more test cases which have been long uncommitted.
John McCall [Fri, 24 Jun 2011 23:30:52 +0000 (23:30 +0000)]
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

13 years agoTest case for r133840, neglectfully uncommitted.
John McCall [Fri, 24 Jun 2011 23:29:50 +0000 (23:29 +0000)]
Test case for r133840, neglectfully uncommitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133841 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHonor objc_precise_lifetime in GC mode by feeding the value
John McCall [Fri, 24 Jun 2011 23:21:27 +0000 (23:21 +0000)]
Honor objc_precise_lifetime in GC mode by feeding the value
in the variable to an inline asm which gets run when the variable
goes out of scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133840 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRevert "Shorten some ARM builtin names by removing unnecessary "neon" prefix."
Bob Wilson [Fri, 24 Jun 2011 22:13:26 +0000 (22:13 +0000)]
Revert "Shorten some ARM builtin names by removing unnecessary "neon" prefix."
Sorry, this was a bad idea.  Within clang these builtins are in a separate
"ARM" namespace, but the actual builtin names should clearly distinguish tha
they are target specific.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133833 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix struct member's scope. Patch by Xi Wang.
Devang Patel [Fri, 24 Jun 2011 22:00:59 +0000 (22:00 +0000)]
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

13 years agoChange the IR-generation of VLAs so that we capture bounds,
John McCall [Fri, 24 Jun 2011 21:55:10 +0000 (21:55 +0000)]
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

13 years agoShorten some ARM builtin names by removing unnecessary "neon" prefix.
Bob Wilson [Fri, 24 Jun 2011 21:32:46 +0000 (21:32 +0000)]
Shorten some ARM builtin names by removing unnecessary "neon" prefix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133826 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoNo need to warn if 'unavailable' method/property
Fariborz Jahanian [Fri, 24 Jun 2011 20:31:37 +0000 (20:31 +0000)]
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

13 years agoobjc-arc: Give more descriptive diagnostics when
Fariborz Jahanian [Fri, 24 Jun 2011 20:00:03 +0000 (20:00 +0000)]
objc-arc: Give more descriptive diagnostics when
making unsafe assignment of a retainable
object, Per John's request.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133817 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOnly do delayed diagnostics if there were no errors when parsing the decl.
Argyrios Kyrtzidis [Fri, 24 Jun 2011 19:59:27 +0000 (19:59 +0000)]
Only do delayed diagnostics if there were no errors when parsing the decl.

Fixes crash in http://llvm.org/PR10109 & rdar://9584039.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133816 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Add test for rdar://9601437.
Argyrios Kyrtzidis [Fri, 24 Jun 2011 18:41:23 +0000 (18:41 +0000)]
[arcmt] Add test for rdar://9601437.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133807 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc-arc: Check on a variety of unsafe assignment of retained
Fariborz Jahanian [Fri, 24 Jun 2011 18:25:34 +0000 (18:25 +0000)]
objc-arc: Check on a variety of unsafe assignment of retained
objects.  // rdar://9495837

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133806 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix comments.
Bob Wilson [Fri, 24 Jun 2011 18:08:10 +0000 (18:08 +0000)]
Fix comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133805 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAllow Lexer::getLocForEndOfToken to return the location just passed the macro instant...
Argyrios Kyrtzidis [Fri, 24 Jun 2011 17:58:59 +0000 (17:58 +0000)]
Allow Lexer::getLocForEndOfToken to return the location just passed the macro instantiation
if the location given points at the last token of the macro instantiation.

Fixes rdar://9045701.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133804 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn TextDiagnosticPrinter::EmitCaretDiagnostic, don't always drop fixits if the caret...
Argyrios Kyrtzidis [Fri, 24 Jun 2011 17:28:31 +0000 (17:28 +0000)]
In TextDiagnosticPrinter::EmitCaretDiagnostic, don't always drop fixits if the caret location
points to a macro instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133802 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAllow the fixit for missing ':' in the ?: ternary operator if it is pointing
Argyrios Kyrtzidis [Fri, 24 Jun 2011 17:28:29 +0000 (17:28 +0000)]
Allow the fixit for missing ':' in the ?: ternary operator if it is pointing
at the start of a macro instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133801 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSourceManager::isAtStartOfMacroInstantiation should check not only if the location
Argyrios Kyrtzidis [Fri, 24 Jun 2011 17:28:26 +0000 (17:28 +0000)]
SourceManager::isAtStartOfMacroInstantiation should check not only if the location
is at the first token but that the location's offset is not inside the token as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133800 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agounittests/Basic/FileManagerTest.cpp: Unbreak Win32, mingw and msvc.
NAKAMURA Takumi [Fri, 24 Jun 2011 14:10:29 +0000 (14:10 +0000)]
unittests/Basic/FileManagerTest.cpp: Unbreak Win32, mingw and msvc.

LLVM_ON_WIN32 is defined in llvm/Config/config.h.
IMO, it might be enough with _WIN32 in most cases, LLVM_ON_xxx could be deprecated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133794 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix unused label warning.
Jay Foad [Fri, 24 Jun 2011 09:29:56 +0000 (09:29 +0000)]
Fix unused label warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133790 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThis patch started as an attempt to fix up the horrid naming
Sean Hunt [Fri, 24 Jun 2011 02:11:39 +0000 (02:11 +0000)]
This patch started as an attempt to fix up the horrid naming
conventions. I then discovered a typo in the using declaration bit in
LookupSpecialMember. This led to discovering [namespace.udecl]p15, which
clang implements incorrectly. Thus I've added a comment and implemented
the code consistently with the rest of clang - that is incorrectly.

And because I don't want to include tests of something incorrect, I've
ripped the test out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133784 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRename objc_lifetime -> objc_ownership, and modify diagnostics to talk about 'ownersh...
Argyrios Kyrtzidis [Fri, 24 Jun 2011 00:08:59 +0000 (00:08 +0000)]
Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about 'ownership', not 'lifetime'.

rdar://9477613.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133779 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen forming a cycle in objc's inheritance hierarchy,
Fariborz Jahanian [Thu, 23 Jun 2011 23:16:19 +0000 (23:16 +0000)]
When forming a cycle in objc's inheritance hierarchy,
diagnose it properly and don't throw clang into an
infinit loop. // rdar://9653341

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133773 91177308-0d34-0410-b5e6-96231b3b80d8