]> granicus.if.org Git - clang/log
clang
13 years agoMake clang behave in a gcc-compatible way in the presence of multiple flags for the...
Eli Friedman [Sat, 2 Jul 2011 00:34:19 +0000 (00:34 +0000)]
Make clang behave in a gcc-compatible way in the presence of multiple flags for the same x86 target feature (e.g. -mno-sse -msse).  gcc uses a somewhat unintuitive algorithm here in that the enabled SSE instructions is based on the order of the *last* flag for *each* feature-level, so that "-mno-sse -msse2" only enables SSE2, but "-mno-sse -msse2 -msse" enables all SSE levels.

Issue reported on cfe-dev.

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

13 years agoAdd a testcase for r134292.
Eric Christopher [Sat, 2 Jul 2011 00:28:30 +0000 (00:28 +0000)]
Add a testcase for r134292.

Part of rdar://9714064

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

13 years agoUpdate for llvm commit r134291.
Eric Christopher [Sat, 2 Jul 2011 00:20:22 +0000 (00:20 +0000)]
Update for llvm commit r134291.

Fixes rdar://9714064

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

13 years agoMove the Sema argument to all of the Sema-using helper functions in
Chandler Carruth [Sat, 2 Jul 2011 00:01:44 +0000 (00:01 +0000)]
Move the Sema argument to all of the Sema-using helper functions in
SemaDeclAttr to the first argument. This makes them follow the very
consistent policy elsewhere in Sema for helper functions.

Original patch by Caitlin Sadowski, with some tweaking by me.

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

13 years agoRename static helpers to use 'camelCaseNames' per the new style
Chandler Carruth [Fri, 1 Jul 2011 23:49:16 +0000 (23:49 +0000)]
Rename static helpers to use 'camelCaseNames' per the new style
recommendations before adding more of them.

Patch by Caitlin Sadowski.

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

13 years agoMechanical rename of 'd' Decl pointer parameters to 'D'. This is more
Chandler Carruth [Fri, 1 Jul 2011 23:49:12 +0000 (23:49 +0000)]
Mechanical rename of 'd' Decl pointer parameters to 'D'. This is more
conventional in the rest of Clang's codebase, and closer to the current
style recommendations. It also makes the code more internally consistent
as FD, VD, etc are used frequently for particular decl variables.

Patch by Caitlin Sadowski.

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

13 years ago-Fix mistake in ASTContext::getInnerObjCOwnership noticed by Doug
Argyrios Kyrtzidis [Fri, 1 Jul 2011 23:01:46 +0000 (23:01 +0000)]
-Fix mistake in ASTContext::getInnerObjCOwnership noticed by Doug
-Remove unnecessary 'return'.
-Remove unnecessary 'if' check (llvm_unreachable make sure attrStr will be non-null)
-Add a test of transferring ownership to a reference cast type.

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

13 years agoAdd initial *-*-rtems* target, from Joel Sherrill
Douglas Gregor [Fri, 1 Jul 2011 22:41:14 +0000 (22:41 +0000)]
Add initial *-*-rtems* target, from Joel Sherrill

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

13 years agoFix the warning that is emitted when an ownership attribute is applied incorrectly.
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:23:09 +0000 (22:23 +0000)]
Fix the warning that is emitted when an ownership attribute is applied incorrectly.

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

13 years agoUse transferARCOwnershipToDeclaratorChunk in inferARCWriteback, no functionality...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:23:05 +0000 (22:23 +0000)]
Use transferARCOwnershipToDeclaratorChunk in inferARCWriteback, no functionality change.

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

13 years agoFix assertion hit in inferARCWriteback.
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:23:03 +0000 (22:23 +0000)]
Fix assertion hit in inferARCWriteback.

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

13 years ago[ARC] When casting from a pointer to an objective-c object with known ownership,...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:59 +0000 (22:22 +0000)]
[ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
(NSString**)&x; // Casting as (__strong NSString**).

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

13 years ago-Remove Sema::ActOnCastOfParenListExpr and move most of its functionality to
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:54 +0000 (22:22 +0000)]
-Remove Sema::ActOnCastOfParenListExpr and move most of its functionality to
 newly introduced Sema::BuildVectorLiteral.
-Make Sema::ActOnCastExpr handle a vector initializer both when the cast'ed expression
 is a ParenListExpr and when it is a ParenExpr.
-Ultimately make Sema::ActOnParenOrParenListExpr independent of what the cast type was.

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

13 years ago[ARC] When casting from a pointer to an objective-c object with known ownership,...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:50 +0000 (22:22 +0000)]
[ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
static_cast<NSString**>(&x); // Casting as (__strong NSString**).

This currently only works for C++ named casts, C casts to follow.

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

13 years agoBreak Sema::GetTypeForDeclarator in 2 functions, one for DeclSpec processing and...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:42 +0000 (22:22 +0000)]
Break Sema::GetTypeForDeclarator in 2 functions, one for DeclSpec processing and another for the rest.
No functionality change.

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

13 years agoIntroduce Declarator::ObjCCatchContext, this will result in correct error for 'auto...
Argyrios Kyrtzidis [Fri, 1 Jul 2011 22:22:40 +0000 (22:22 +0000)]
Introduce Declarator::ObjCCatchContext, this will result in correct error for 'auto' in obj-c catch.

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

13 years agoRefactor AttributeList.h to use alphabetical order, from Caitlin Sadowski
Douglas Gregor [Fri, 1 Jul 2011 22:04:06 +0000 (22:04 +0000)]
Refactor AttributeList.h to use alphabetical order, from Caitlin Sadowski

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

13 years agoEmit guard variables for any weak global that has a run-time
Douglas Gregor [Fri, 1 Jul 2011 21:54:36 +0000 (21:54 +0000)]
Emit guard variables for any weak global that has a run-time
initializer. Previously, we only used guard variables for weak static
data members. Fixes <rdar://problem/9692249>.

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

13 years agoWhen adding boolean keywords for typo correction, add either "bool" or
Douglas Gregor [Fri, 1 Jul 2011 21:27:45 +0000 (21:27 +0000)]
When adding boolean keywords for typo correction, add either "bool" or
"_Bool" (depending on dialect), but not both, since they have the same
edit distance from "Bool".

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

13 years agoFix testcase
Douglas Gregor [Fri, 1 Jul 2011 21:19:15 +0000 (21:19 +0000)]
Fix testcase

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

13 years agoDon't zero-initialize default-initialized local variables that have
Douglas Gregor [Fri, 1 Jul 2011 21:08:19 +0000 (21:08 +0000)]
Don't zero-initialize default-initialized local variables that have
trivial default constructors. This generated-code regression was
caused by r131796, which had simplified the handling of default
initialization in Sema. Fixes <rdar://problem/9694300>.

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

13 years agoFor code such as:
Richard Trieu [Fri, 1 Jul 2011 20:54:02 +0000 (20:54 +0000)]
For code such as:

int f(int x) {
  if (int foo = f(bar)) {}
  return 0;
}

Clang produces the following error messages:

paren_imbalance.cc:2:19: error: use of undeclared identifier 'bar'
  if (int foo = f(bar)) {}
                  ^
paren_imbalance.cc:2:26: error: expected ')'
  if (int foo = f(bar)) {}
                        ^
paren_imbalance.cc:2:6: note: to match this '('
  if (int foo = f(bar)) {}
     ^

The second error is incorrect.  This patch will stop Clang from producing an error on parenthesis imbalance during error recovery when there isn't one.

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

13 years agoFix for PR7410. Allow functions in a derived class that improperly overwrite a virtua...
Richard Trieu [Fri, 1 Jul 2011 20:02:53 +0000 (20:02 +0000)]
Fix for PR7410. Allow functions in a derived class that improperly overwrite a virtual function in the base class to be inserted into the derived class function list to prevent extra errors every time the derived class is used.

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

13 years agoFix AST representations of alias-declarations which define tag types. Inside classes...
Richard Smith [Fri, 1 Jul 2011 19:46:12 +0000 (19:46 +0000)]
Fix AST representations of alias-declarations which define tag types. Inside classes, the tag types need to have an associated access specifier, and inside function definitions, they need to be included in the declarations of the DeclStmt. These issues manifested as assertions during template instantiation, and also in a WIP constexpr patch.

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

13 years agoWhen we create a precompiled preamble, don't copy the
Douglas Gregor [Fri, 1 Jul 2011 18:22:13 +0000 (18:22 +0000)]
When we create a precompiled preamble, don't copy the
CompilerInvocation on the stack, because other objects (e.g., the
CompilerInstance) maintain an intrusive reference-counted pointer to
the CompilerInvocation. This doesn't matter in the normal case,
because we take back the CompilerInvocation. However, during crash
recovery, this leads to us trying to free an object on the stack, and
hilarity ensues. Fixes <rdar://problem/9652540>.

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

13 years agoRemove reference to the Index library
Douglas Gregor [Fri, 1 Jul 2011 16:35:47 +0000 (16:35 +0000)]
Remove reference to the Index library

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

13 years agoJust mangle substituted template parameter types as unresolved types.
John McCall [Fri, 1 Jul 2011 02:19:08 +0000 (02:19 +0000)]
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

13 years agoIntroduce the notion of instantiation dependence into Clang's AST. A
Douglas Gregor [Fri, 1 Jul 2011 01:22:09 +0000 (01:22 +0000)]
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

13 years agoChange the mangling of enclosing template template parameters
John McCall [Fri, 1 Jul 2011 00:04:39 +0000 (00:04 +0000)]
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

13 years agoNo, actually, we do need to be able to mangle substituted template names.
John McCall [Thu, 30 Jun 2011 21:59:02 +0000 (21:59 +0000)]
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

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