]> granicus.if.org Git - clang/log
clang
14 years agoStandardize the parsing of function type attributes in a way that
John McCall [Fri, 5 Feb 2010 21:31:56 +0000 (21:31 +0000)]
Standardize the parsing of function type attributes in a way that
follows (as conservatively as possible) gcc's current behavior:  attributes
written on return types that don't apply there are applied to the function
instead, etc.  Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks).  Consistently consume CC/noreturn
information throughout codegen;  enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().

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

14 years agoAdd guard in RewriteObjC::HandleTopLevelSingleDecl() to not do
Ted Kremenek [Fri, 5 Feb 2010 21:28:51 +0000 (21:28 +0000)]
Add guard in RewriteObjC::HandleTopLevelSingleDecl() to not do
anything when Sema has issued an error.  This matches the behavior in
RewriteObjC::HandleTranslationUnit().

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

14 years agoRevert r95393, which broke Clang's self-host.
Douglas Gregor [Fri, 5 Feb 2010 21:10:36 +0000 (21:10 +0000)]
Revert r95393, which broke Clang's self-host.

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

14 years agoOops, thanks Clang
Douglas Gregor [Fri, 5 Feb 2010 21:07:53 +0000 (21:07 +0000)]
Oops, thanks Clang

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

14 years agoConvert this test to FileCheck instead of grepping LLVM IR.
Charles Davis [Fri, 5 Feb 2010 20:45:48 +0000 (20:45 +0000)]
Convert this test to FileCheck instead of grepping LLVM IR.

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

14 years agoImplement name mangling for template template parameters
Douglas Gregor [Fri, 5 Feb 2010 20:45:00 +0000 (20:45 +0000)]
Implement name mangling for template template parameters

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

14 years agoFix how scan-build finds c++-analyzer to work with checker builds.
Ted Kremenek [Fri, 5 Feb 2010 20:34:14 +0000 (20:34 +0000)]
Fix how scan-build finds c++-analyzer to work with checker builds.

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

14 years agoIRgen: A few more ConvertType cleanups.
Daniel Dunbar [Fri, 5 Feb 2010 20:02:42 +0000 (20:02 +0000)]
IRgen: A few more ConvertType cleanups.

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

14 years agoFix two issues with the substitution of template template parameters
Douglas Gregor [Fri, 5 Feb 2010 19:54:12 +0000 (19:54 +0000)]
Fix two issues with the substitution of template template parameters
when instantiating the declaration of a member template:
  - Only check if the have a template template argument at a specific position
  when we already know that we have template arguments at that level;
  otherwise, we're substituting for a level-reduced template template
  parameter.
  - When trying to find an instantiated declaration for a template
  template parameter, look into the instantiated scope. This was a
  typo, where we had two checks for TemplateTypeParmDecl, one of
  which should have been a TemplateTemplateParmDecl.

With these changes, tramp3d-v4 passes -fsyntax-only.

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

14 years agoIRgen: Factor out EmitAggExprToLValue.
Daniel Dunbar [Fri, 5 Feb 2010 19:38:31 +0000 (19:38 +0000)]
IRgen: Factor out EmitAggExprToLValue.

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

14 years agoFix a code gen bug accessing 'isa' field via a message call
Fariborz Jahanian [Fri, 5 Feb 2010 19:18:30 +0000 (19:18 +0000)]
Fix a code gen bug accessing 'isa' field via a message call
(Fixes radar 7609722).

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

14 years agoWhen we're parsing an expression that may have looked like a
Douglas Gregor [Fri, 5 Feb 2010 19:11:37 +0000 (19:11 +0000)]
When we're parsing an expression that may have looked like a
declaration, we can end up with template-id annotation tokens for
types that have not been converted into type annotation tokens. When
this is the case, translate the template-id into a type and parse as
an expression.

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

14 years agoIRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that is
Daniel Dunbar [Fri, 5 Feb 2010 18:56:49 +0000 (18:56 +0000)]
IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that is
conceptually correct. Review appreciated (Chris, Eli, Anders).

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

14 years agoFix the bug that was breaking self-host, and re-land the static ctor fixes.
Anders Carlsson [Fri, 5 Feb 2010 18:38:45 +0000 (18:38 +0000)]
Fix the bug that was breaking self-host, and re-land the static ctor fixes.

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

14 years agoNow that we store calling conventions in the types, use them instead of
Charles Davis [Fri, 5 Feb 2010 18:13:10 +0000 (18:13 +0000)]
Now that we store calling conventions in the types, use them instead of
getting the calling convention from the target function, which may or may not
exist. Fixes PR5280.

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

14 years agoRemoved non-essential header file from test.
Fariborz Jahanian [Fri, 5 Feb 2010 18:04:36 +0000 (18:04 +0000)]
Removed non-essential header file from test.

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

14 years agoInitial skeleton of an AST "importer", which will take AST elements from
Douglas Gregor [Fri, 5 Feb 2010 17:54:41 +0000 (17:54 +0000)]
Initial skeleton of an AST "importer", which will take AST elements from
one context and import them into another context, merging them
according to language-specific rules. This is a skeleton. It doesn't
work, it isn't testable, but I want it in version control.

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

14 years agoTesting, 1, 2, 3...
Charles Davis [Fri, 5 Feb 2010 17:53:51 +0000 (17:53 +0000)]
Testing, 1, 2, 3...

Also make the comments I added in r95291 consistent.

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

14 years agoIRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
Daniel Dunbar [Fri, 5 Feb 2010 17:51:33 +0000 (17:51 +0000)]
IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
need to deal with aggregates specially; this is consistent with the rest of IRgen.

Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString.

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

14 years agoFixes a minor rewriter bug messaging inside a function call.
Fariborz Jahanian [Fri, 5 Feb 2010 17:48:10 +0000 (17:48 +0000)]
Fixes a minor rewriter bug messaging inside a function call.
Fixes radar 7617047.

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

14 years agoSome clean up of replacement text API no longer needed by
Fariborz Jahanian [Fri, 5 Feb 2010 16:43:40 +0000 (16:43 +0000)]
Some clean up of replacement text API no longer needed by
my recent changes.

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

14 years agoRevert r95363 and r95375, which broke self-host.
Douglas Gregor [Fri, 5 Feb 2010 16:18:08 +0000 (16:18 +0000)]
Revert r95363 and r95375, which broke self-host.

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

14 years agoA dependent initializer with zero arguments should return a NULL
Douglas Gregor [Fri, 5 Feb 2010 07:56:11 +0000 (07:56 +0000)]
A dependent initializer with zero arguments should return a NULL
initializer (for no initialization) rather than a ParenListExpr with
zero arguments in it.

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

14 years agoRevert the unused TST_pixel entry from r95335 as it is not listed in the Sema
Chandler Carruth [Fri, 5 Feb 2010 07:38:55 +0000 (07:38 +0000)]
Revert the unused TST_pixel entry from r95335 as it is not listed in the Sema
switch, triggering warnings.

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

14 years agoDefault function arguments for function template specializations
Douglas Gregor [Fri, 5 Feb 2010 07:33:43 +0000 (07:33 +0000)]
Default function arguments for function template specializations
always come from the primary template, so gather the instantiation
template arguments from the primary template.

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

14 years agoTweak inliner thresholds to match llvm-gcc, see r95321.
Daniel Dunbar [Fri, 5 Feb 2010 07:32:37 +0000 (07:32 +0000)]
Tweak inliner thresholds to match llvm-gcc, see r95321.

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

14 years agoCheck in a mangle checker that's turned off by default.
Anders Carlsson [Fri, 5 Feb 2010 07:31:37 +0000 (07:31 +0000)]
Check in a mangle checker that's turned off by default.

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

14 years agoTeach C++ name lookup that it's okay to look in a scope without a
Douglas Gregor [Fri, 5 Feb 2010 07:07:10 +0000 (07:07 +0000)]
Teach C++ name lookup that it's okay to look in a scope without a
context. This happens fairly rarely (which is why we got away with
this bug). Fixes PR6184, where we skipped over the template parameter
scope while tentatively parsing.

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

14 years agoFix array initialization test.
Anders Carlsson [Fri, 5 Feb 2010 07:00:11 +0000 (07:00 +0000)]
Fix array initialization test.

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

14 years agoFix a test case.
Anders Carlsson [Fri, 5 Feb 2010 06:58:06 +0000 (06:58 +0000)]
Fix a test case.

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

14 years agoA function declarator with a non-identifier name in an anonymous class
Douglas Gregor [Fri, 5 Feb 2010 06:12:42 +0000 (06:12 +0000)]
A function declarator with a non-identifier name in an anonymous class
is a constructor for that class, right? Fixes PR6238.

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

14 years agoAdd test case showing the analyzer invalidates '__block' variables when the block...
Ted Kremenek [Fri, 5 Feb 2010 06:10:46 +0000 (06:10 +0000)]
Add test case showing the analyzer invalidates '__block' variables when the block is passed as an argument to an ObjC method.

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

14 years agoMore GRState* -> Store changes.
Zhongxing Xu [Fri, 5 Feb 2010 05:34:29 +0000 (05:34 +0000)]
More GRState* -> Store changes.

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

14 years agoRemove unused parameter.
Zhongxing Xu [Fri, 5 Feb 2010 05:24:20 +0000 (05:24 +0000)]
Remove unused parameter.

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

14 years agoIf a global initializer has a non-trivial destructor it can't be emitted as a constan...
Anders Carlsson [Fri, 5 Feb 2010 05:19:42 +0000 (05:19 +0000)]
If a global initializer has a non-trivial destructor it can't be emitted as a constant (even if it has a trivial constructor).

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

14 years agoMore GRState* -> Store changes.
Zhongxing Xu [Fri, 5 Feb 2010 05:18:47 +0000 (05:18 +0000)]
More GRState* -> Store changes.

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

14 years agoWhen adding ADL candidates for overloaded
Douglas Gregor [Fri, 5 Feb 2010 05:15:43 +0000 (05:15 +0000)]
When adding ADL candidates for overloaded
post-increment/post-decrement operators, be sure to consider both
arguments. Fixes PR6237.

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

14 years agoMore GRState* -> Store changes.
Zhongxing Xu [Fri, 5 Feb 2010 05:06:13 +0000 (05:06 +0000)]
More GRState* -> Store changes.

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

14 years agoWhen determining whether a scope specifier is complete, consider a
Douglas Gregor [Fri, 5 Feb 2010 04:39:02 +0000 (04:39 +0000)]
When determining whether a scope specifier is complete, consider a
dependent DeclContext to be "complete". Fixes PR6236.

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

14 years agoMore GRState* -> Store changes.
Zhongxing Xu [Fri, 5 Feb 2010 03:01:53 +0000 (03:01 +0000)]
More GRState* -> Store changes.

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

14 years agoChange LazyCompoundVal to a <Store, MemRegion*> pair. We really don't need to
Zhongxing Xu [Fri, 5 Feb 2010 02:26:30 +0000 (02:26 +0000)]
Change LazyCompoundVal to a <Store, MemRegion*> pair. We really don't need to
spread GRState* everywhere.

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

14 years agoNow that the -cc1 options for analyzer checks have a structured naming, add back...
Ted Kremenek [Fri, 5 Feb 2010 02:18:39 +0000 (02:18 +0000)]
Now that the -cc1 options for analyzer checks have a structured naming, add back scanning for analyzer checks to scan-build.

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

14 years agoRename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.
Ted Kremenek [Fri, 5 Feb 2010 02:06:54 +0000 (02:06 +0000)]
Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.

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

14 years agoRename -cc1 option '-warn-objc-missing-dealloc' to '-analyzer-check-objc-missing...
Ted Kremenek [Fri, 5 Feb 2010 01:59:21 +0000 (01:59 +0000)]
Rename -cc1 option '-warn-objc-missing-dealloc' to '-analyzer-check-objc-missing-dealloc'.

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

14 years agoRename -cc1 option '-warn-objc-methodsigs' to '-analyzer-check-objc-methodsigs'.
Ted Kremenek [Fri, 5 Feb 2010 01:57:44 +0000 (01:57 +0000)]
Rename -cc1 option '-warn-objc-methodsigs' to '-analyzer-check-objc-methodsigs'.

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

14 years agoRename -cc1 option '-warn-objc-unused-ivars' to '-analyzer-check-objc-unused-ivars'.
Ted Kremenek [Fri, 5 Feb 2010 01:55:01 +0000 (01:55 +0000)]
Rename -cc1 option '-warn-objc-unused-ivars' to '-analyzer-check-objc-unused-ivars'.

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

14 years agoRename -cc1 option '-warn-dead-stores' to '-analyzer-check-dead-stores'.
Ted Kremenek [Fri, 5 Feb 2010 01:52:40 +0000 (01:52 +0000)]
Rename -cc1 option '-warn-dead-stores' to '-analyzer-check-dead-stores'.

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

14 years agoRename -cc1 option '-warn-security-syntactic' to '-analyzer-check-security-syntactic'.
Ted Kremenek [Fri, 5 Feb 2010 01:50:36 +0000 (01:50 +0000)]
Rename -cc1 option '-warn-security-syntactic' to '-analyzer-check-security-syntactic'.

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

14 years agoFix a nested ivar reference rewriting bug.
Fariborz Jahanian [Fri, 5 Feb 2010 01:35:00 +0000 (01:35 +0000)]
Fix a nested ivar reference rewriting bug.
(Fixes radar 7607605).

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

14 years agoAlways start tag definitions before completing them. Assert same.
John McCall [Fri, 5 Feb 2010 01:33:36 +0000 (01:33 +0000)]
Always start tag definitions before completing them.  Assert same.

Fixes latent and not-so-latent objc++ and blocks++ bugs.

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

14 years agoFirst stage of adding AltiVec support
John Thompson [Fri, 5 Feb 2010 00:12:22 +0000 (00:12 +0000)]
First stage of adding AltiVec support

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

14 years agoFix a crash with ill-formed code within a method in an ill-formed
Douglas Gregor [Thu, 4 Feb 2010 23:42:48 +0000 (23:42 +0000)]
Fix a crash with ill-formed code within a method in an ill-formed
category implementation, which showed up during (attempted) typo
correction. Fixes <rdar://problem/7605289>.

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

14 years agoExtract a common structure for holding information about the definition
John McCall [Thu, 4 Feb 2010 22:26:26 +0000 (22:26 +0000)]
Extract a common structure for holding information about the definition
of a C++ record.  Exposed a lot of problems where various routines were
silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order)
when presented with a non-definition.  Also cuts down on memory usage.

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

14 years agoMove ParseFormatString() and FormatStringHandler back into the analyze_printf namespace.
Ted Kremenek [Thu, 4 Feb 2010 20:46:58 +0000 (20:46 +0000)]
Move ParseFormatString() and FormatStringHandler back into the analyze_printf namespace.

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

14 years agoFix an obscure crash found in the Boost.MPL test suite, along with a
Douglas Gregor [Thu, 4 Feb 2010 18:10:26 +0000 (18:10 +0000)]
Fix an obscure crash found in the Boost.MPL test suite, along with a
ton of potential crashes of the same kind. The fundamental problem is
that type creation was following a dangerous pattern when using its
FoldingSets:
  1) Use FindNodeOrInsertPos to see if the type is available
  2) If not, and we aren't looking at a canonical type, build the
  canonical type
  3) Build and insert the new node into the FoldingSet

The problem here is that building the canonical type can, in very rare
circumstances, force the hash table inside the FoldingSet to
reallocate. That invalidates the insertion position we computed in
step 1, and in step 3 we end up inserting the new node into the wrong
place. BOOM!

I've audited all of ASTContext, fixing this problem everywhere I found
it. The vast majority of wrong code was C++-specific (and *ahem*
written by me), so I also audited other major folding sets in the C++
code (e.g., template specializations), but found no other instances of
this problem.

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

14 years agoWhen binding an lvalue to a reference, we always need to pop temporaries.
Anders Carlsson [Thu, 4 Feb 2010 17:32:58 +0000 (17:32 +0000)]
When binding an lvalue to a reference, we always need to pop temporaries.

With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives:

Expected Passes    : 6933
Expected Failures  : 46
Unsupported Tests  : 40
Unexpected Failures: 27

which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers.

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

14 years agoUpdate test.
Anders Carlsson [Thu, 4 Feb 2010 17:29:32 +0000 (17:29 +0000)]
Update test.

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

14 years agoFix a bug where we would not mark temporaries as conditional when emitting a conditio...
Anders Carlsson [Thu, 4 Feb 2010 17:26:01 +0000 (17:26 +0000)]
Fix a bug where we would not mark temporaries as conditional when emitting a conditional operator as an lvalue.

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

14 years agoImprove conditional temporaries test.
Anders Carlsson [Thu, 4 Feb 2010 17:23:15 +0000 (17:23 +0000)]
Improve conditional temporaries test.

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

14 years agoWhen substituting the template argument for a pointer non-type
Douglas Gregor [Thu, 4 Feb 2010 17:21:48 +0000 (17:21 +0000)]
When substituting the template argument for a pointer non-type
template parameter, perform array/function decay (if needed), take the
address of the argument (if needed), perform qualification conversions
(if needed), and remove any top-level cv-qualifiers from the resulting
expression. Fixes PR6226.

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

14 years agoRename StartConditionalBranch/FinishConditionalBranch to BeginConditionalBranch/EndCo...
Anders Carlsson [Thu, 4 Feb 2010 17:18:07 +0000 (17:18 +0000)]
Rename StartConditionalBranch/FinishConditionalBranch to BeginConditionalBranch/EndConditionalBranch.

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

14 years agoFix another pointer-to-member function miscompile, this time when trying to call...
Anders Carlsson [Thu, 4 Feb 2010 17:08:48 +0000 (17:08 +0000)]
Fix another pointer-to-member function miscompile, this time when trying to call a virtual member function.

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

14 years agoImprove test.
Anders Carlsson [Thu, 4 Feb 2010 17:06:52 +0000 (17:06 +0000)]
Improve test.

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

14 years agoCalculate offset correctly when taking the address of a virtual member function.
Anders Carlsson [Thu, 4 Feb 2010 16:38:05 +0000 (16:38 +0000)]
Calculate offset correctly when taking the address of a virtual member function.

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

14 years agoConvert flags in FormatSpecifier to be bitfields instead of doing
Ted Kremenek [Thu, 4 Feb 2010 07:27:39 +0000 (07:27 +0000)]
Convert flags in FormatSpecifier to be bitfields instead of doing
direct bit manipulation.  This is is less error prone, and fixes a bug
in the handling of the LeadingZeroes flag as pointed out by Cristian
Draghici.

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

14 years agoAdd assorted test cases from PR 4172.
Ted Kremenek [Thu, 4 Feb 2010 07:25:56 +0000 (07:25 +0000)]
Add assorted test cases from PR 4172.

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

14 years agoAllow calling convention attributes to apply to types. Patch by Chip Davis!
John McCall [Thu, 4 Feb 2010 05:44:44 +0000 (05:44 +0000)]
Allow calling convention attributes to apply to types.  Patch by Chip Davis!

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

14 years agoCast evaluation no longer touch GRState.
Zhongxing Xu [Thu, 4 Feb 2010 04:56:43 +0000 (04:56 +0000)]
Cast evaluation no longer touch GRState.

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

14 years agoSpecially handle casts to 'void' in AdjustedReturnValueChecker.
Ted Kremenek [Thu, 4 Feb 2010 04:18:55 +0000 (04:18 +0000)]
Specially handle casts to 'void' in AdjustedReturnValueChecker.

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

14 years agoRemove stray typo.
Ted Kremenek [Thu, 4 Feb 2010 04:14:49 +0000 (04:14 +0000)]
Remove stray typo.

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

14 years agoMangle member expressions. Also invented.
John McCall [Thu, 4 Feb 2010 02:56:29 +0000 (02:56 +0000)]
Mangle member expressions.  Also invented.

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

14 years agoNow that CastRetrievedVal returns SVal, there is no need to use CastResult.
Zhongxing Xu [Thu, 4 Feb 2010 02:39:47 +0000 (02:39 +0000)]
Now that CastRetrievedVal returns SVal, there is no need to use CastResult.

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

14 years agoAdd a cautionary note about the mangling I just invented.
John McCall [Thu, 4 Feb 2010 01:48:38 +0000 (01:48 +0000)]
Add a cautionary note about the mangling I just invented.

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

14 years agoAdd mangling support for calls, sizeof/alignof, constructor calls,
John McCall [Thu, 4 Feb 2010 01:42:13 +0000 (01:42 +0000)]
Add mangling support for calls, sizeof/alignof, constructor calls,
float literals, and unresolved lookups (which required hand-wavey extensions).

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

14 years agostatic analyzer: handle casts of a function to a function pointer with
Ted Kremenek [Thu, 4 Feb 2010 00:47:48 +0000 (00:47 +0000)]
static analyzer: handle casts of a function to a function pointer with
a different return type.  While we don't emit any errors (yet), at
least we avoid cases where we might crash because of an assertion
failure later on (when the return type differs from what is expected).

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

14 years agoFix rewriting of 'const' __block variables in
Fariborz Jahanian [Thu, 4 Feb 2010 00:07:58 +0000 (00:07 +0000)]
Fix rewriting of 'const' __block variables in
the rewriter. (Fixes radar 7607781).

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

14 years agoDon't try to fold DeclRefExprs that point to ParmVarDecls. This had the side-effect...
Anders Carlsson [Wed, 3 Feb 2010 21:58:41 +0000 (21:58 +0000)]
Don't try to fold DeclRefExprs that point to ParmVarDecls. This had the side-effect of always folding the expression to the default argument of the parameter. For example:

void f(int a = 10) {
  return a;
}

would always return 10, regardless of the passed in argument.

This fixes another 600 test failures. We're now down to only 137 failures!

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

14 years agoFix more rewriting of protocol-quialified 'id' type.
Fariborz Jahanian [Wed, 3 Feb 2010 21:29:28 +0000 (21:29 +0000)]
Fix more rewriting of protocol-quialified 'id' type.
(Fixes radar 7607413).

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

14 years agoIn some contexts, type declarations cannot occur. Pass this information down to Parse...
Sebastian Redl [Wed, 3 Feb 2010 21:21:43 +0000 (21:21 +0000)]
In some contexts, type declarations cannot occur. Pass this information down to ParseClassSpecifier, to make its decision easier. Fixes PR6200.

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

14 years agodon't inform comment handlers about comments in #if 0 blocks,
Chris Lattner [Wed, 3 Feb 2010 21:06:21 +0000 (21:06 +0000)]
don't inform comment handlers about comments in #if 0 blocks,
doing so invalidates the file guard optimization and is not
in the spirit of "#if 0" because it is supposed to completely
skip everything, even if it isn't lexically valid. Patch by
Abramo Bagnara!

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

14 years agoDefine two types to be "compatible" in C++ if they are the same, and
Douglas Gregor [Wed, 3 Feb 2010 21:02:30 +0000 (21:02 +0000)]
Define two types to be "compatible" in C++ if they are the same, and
remove some age-old FIXMEs and C++ workarounds within the
type-compatibility logic.

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

14 years agoDeclarators can have grouping parens. This fixes rdar://7608537.
Chris Lattner [Wed, 3 Feb 2010 20:41:24 +0000 (20:41 +0000)]
Declarators can have grouping parens.  This fixes rdar://7608537.

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

14 years agoPatch to allow reinterpret_cast on objective-c pointers.
Fariborz Jahanian [Wed, 3 Feb 2010 20:32:31 +0000 (20:32 +0000)]
Patch to allow reinterpret_cast on objective-c pointers.
(partial fix for radar 7591784).

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

14 years agoRevert "Numerous changes to selector handling:", this breaks a whole bunch of
Daniel Dunbar [Wed, 3 Feb 2010 20:11:42 +0000 (20:11 +0000)]
Revert "Numerous changes to selector handling:", this breaks a whole bunch of
working code, for no apparent reason.

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

14 years agoTop-level const changes do not make a qualification conversion. Fixes PR6089.
Sebastian Redl [Wed, 3 Feb 2010 19:36:07 +0000 (19:36 +0000)]
Top-level const changes do not make a qualification conversion. Fixes PR6089.

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

14 years agoWhen determining whether a function without a prototype is compatible
Douglas Gregor [Wed, 3 Feb 2010 19:27:29 +0000 (19:27 +0000)]
When determining whether a function without a prototype is compatible
with a function with a prototype, treat parameters of enumeration type
based on the enumeration type's promotion type.

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

14 years agoHandle reference binding in aggregate initializers. Fixes another 47 tests.
Anders Carlsson [Wed, 3 Feb 2010 19:13:55 +0000 (19:13 +0000)]
Handle reference binding in aggregate initializers. Fixes another 47 tests.

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

14 years agoAdd a band-aid fix for clang self-hosting. A better fix will follow shortly.
Anders Carlsson [Wed, 3 Feb 2010 18:54:13 +0000 (18:54 +0000)]
Add a band-aid fix for clang self-hosting. A better fix will follow shortly.

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

14 years agoFix for PR6220: compute the correct type for multicharacter literals.
Eli Friedman [Wed, 3 Feb 2010 18:21:45 +0000 (18:21 +0000)]
Fix for PR6220: compute the correct type for multicharacter literals.

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

14 years agoMore cleanup.
Anders Carlsson [Wed, 3 Feb 2010 17:33:16 +0000 (17:33 +0000)]
More cleanup.

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

14 years agoRevert the new reference binding code; I came up with a way simpler solution for...
Anders Carlsson [Wed, 3 Feb 2010 16:38:03 +0000 (16:38 +0000)]
Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.

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

14 years agoFirst pass at adding GC support for GNU runtime. GC ivar maps not yet constructed...
David Chisnall [Wed, 3 Feb 2010 15:59:02 +0000 (15:59 +0000)]
First pass at adding GC support for GNU runtime.  GC ivar maps not yet constructed, GC flag not set.

Please don't try using this yet - the runtime support is still very immature and your code will almost certainly crash if you do.

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

14 years agoTeach the allocation function overload handling to deal with templates, and
Chandler Carruth [Wed, 3 Feb 2010 11:02:14 +0000 (11:02 +0000)]
Teach the allocation function overload handling to deal with templates, and
prevent a crash on templates when looking for an existing declaration of the
predefined global operators. This fixes PR5918.

Added an easy test case for the overload handling, but testing the crash is
a bit trickier. Created a new test that can use multiple runs with a define to
trigger which test case is used so we can test this type of issue.

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

14 years agoFix PR6149 by looking at the qualifiers on the referred to type for non-type
Chandler Carruth [Wed, 3 Feb 2010 09:37:33 +0000 (09:37 +0000)]
Fix PR6149 by looking at the qualifiers on the referred to type for non-type
reference template arguments. Adds test cases for the cv-quals of reference
arguments.

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

14 years agoWhen a function or variable somehow depends on a type or declaration
Douglas Gregor [Wed, 3 Feb 2010 09:33:45 +0000 (09:33 +0000)]
When a function or variable somehow depends on a type or declaration
that is in an anonymous namespace, give that function or variable
internal linkage.

This change models an oddity of the C++ standard, where names declared
in an anonymous namespace have external linkage but, because anonymous
namespace are really "uniquely-named" namespaces, the names cannot be
referenced from other translation units. That means that they have
external linkage for semantic analysis, but the only sensible
implementation for code generation is to give them internal
linkage. We now model this notion via the UniqueExternalLinkage
linkage type. There are several changes here:

  - Extended NamedDecl::getLinkage() to produce UniqueExternalLinkage
    when the declaration is in an anonymous namespace.
  - Added Type::getLinkage() to determine the linkage of a type, which
    is defined as the minimum linkage of the types (when we're dealing
    with a compound type that is not a struct/class/union).
  - Extended NamedDecl::getLinkage() to consider the linkage of the
    template arguments and template parameters of function template
    specializations and class template specializations.
  - Taught code generation to rely on NamedDecl::getLinkage() when
    determining the linkage of variables and functions, also
    considering the linkage of the types of those variables and
    functions (C++ only). Map UniqueExternalLinkage to internal
    linkage, taking out the explicit checks for
    isInAnonymousNamespace().

This fixes much of PR5792, which, as discovered by Anders Carlsson, is
actually the reason behind the pass-manager assertion that causes the
majority of clang-on-clang regression test failures. With this fix,
Clang-built-Clang+LLVM passes 88% of its regression tests (up from
67%). The specific numbers are:

LLVM:
  Expected Passes    : 4006
  Expected Failures  : 32
  Unsupported Tests  : 40
  Unexpected Failures: 736

Clang:
  Expected Passes    : 1903
  Expected Failures  : 14
  Unexpected Failures: 75

Overall:
  Expected Passes    : 5909
  Expected Failures  : 46
  Unsupported Tests  : 40
  Unexpected Failures: 811

Still to do:
  - Improve testing
  - Check whether we should allow the presence of types with
  InternalLinkage (in addition to UniqueExternalLinkage) given
  variables/functions internal linkage in C++, as mentioned in
  PR5792.
  - Determine how expensive the getLinkage() calls are in practice;
  consider caching the result in NamedDecl.
  - Assess the feasibility of Chris's idea in comment #1 of PR5792.

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

14 years agoAdd FlatStore.cpp (from r95214) to CMake build. Don't forget about it! =D
Chandler Carruth [Wed, 3 Feb 2010 09:31:39 +0000 (09:31 +0000)]
Add FlatStore.cpp (from r95214) to CMake build. Don't forget about it! =D

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

14 years agoAdd skeleton of flat store manager.
Zhongxing Xu [Wed, 3 Feb 2010 09:10:32 +0000 (09:10 +0000)]
Add skeleton of flat store manager.

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

14 years agoLook through CXXExprWithTemporaries when digging out the original
Douglas Gregor [Wed, 3 Feb 2010 09:01:59 +0000 (09:01 +0000)]
Look through CXXExprWithTemporaries when digging out the original
initializer. Grrr....

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

14 years agoupdate for llvm api change.
Chris Lattner [Wed, 3 Feb 2010 05:55:22 +0000 (05:55 +0000)]
update for llvm api change.

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

14 years agoremove a big chunk of #if 0 code.
Chris Lattner [Wed, 3 Feb 2010 05:28:17 +0000 (05:28 +0000)]
remove a big chunk of #if 0 code.

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