]> granicus.if.org Git - clang/log
clang
14 years agoMove traverseunqualifiedtypeloc over to the 'main' typeloc tree.
Craig Silverstein [Fri, 9 Jul 2010 15:19:34 +0000 (15:19 +0000)]
Move traverseunqualifiedtypeloc over to the 'main' typeloc tree.
Note that this is a move -- we pretend that we were really looking
at the unqualified typeloc all along -- rather than a recursion, so
we don't follow the normal CRTP plan of going through
getDerived().TraverseTypeLoc.  If we did, we'd be traversing twice
for the same type (once as a QualifiedTypeLoc version of the type,
once as an UnqualifiedTypeLoc version of the type), which in effect
means we'd call VisitTypeLoc twice with the 'same' type.  This
solves that problem, at the cost of never seeing the qualified
version of the type (unless the client subclasses
TraverseQualifiedTypeLoc themselves).  It's not a perfect solution.
A perfect solution probably requires making QualifiedTypeLoc a
wrapper around TypeLoc -- like QualType is a wrapper around Type*
-- rather than being its own class in the type hierarchy.

Reviewed by wan.

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

14 years agoRevert 107953, remove comma ignoring from PPC constraints.
John Thompson [Fri, 9 Jul 2010 04:53:08 +0000 (04:53 +0000)]
Revert 107953, remove comma ignoring from PPC constraints.

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

14 years agoUpdating PPC target to ignore commas in asm contrains, as apparently that is what...
John Thompson [Fri, 9 Jul 2010 02:01:40 +0000 (02:01 +0000)]
Updating PPC target to ignore commas in asm contrains, as apparently that is what gcc does.

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

14 years agoAdd a frontend option -chained-pch and don't pass an active PCH reader to the PCH...
Sebastian Redl [Fri, 9 Jul 2010 00:00:58 +0000 (00:00 +0000)]
Add a frontend option -chained-pch and don't pass an active PCH reader to the PCH writer if it is not set, preventing creation of chained PCH files. Since the reader is so far unused, effectively no functionality change.

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

14 years agoCleanup in CStringChecker. Now properly bifurcates the state for zero/nonzero sizes.
Jordy Rose [Thu, 8 Jul 2010 23:57:29 +0000 (23:57 +0000)]
Cleanup in CStringChecker. Now properly bifurcates the state for zero/nonzero sizes.

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

14 years agoSupport code completion for parameter names in Objective-C method
Douglas Gregor [Thu, 8 Jul 2010 23:37:41 +0000 (23:37 +0000)]
Support code completion for parameter names in Objective-C method
declarations.

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

14 years agoIntroduce a new code-completion point prior to an identifier in the
Douglas Gregor [Thu, 8 Jul 2010 23:20:03 +0000 (23:20 +0000)]
Introduce a new code-completion point prior to an identifier in the
selector of an Objective-C method declaration, e.g., given

  - (int)first:(int)x second:(int)y;

this code completion point triggers at the location of "second". It
will provide completions that fill out the method declaration for any
known method, anywhere in the translation unit.

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

14 years agoWhen looking for an entity's Scope, don't consider scopes that can't contain declarat...
Sebastian Redl [Thu, 8 Jul 2010 23:07:34 +0000 (23:07 +0000)]
When looking for an entity's Scope, don't consider scopes that can't contain declarations. Fixes PR7594.

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

14 years agoSome preparatory work for chained PCH. No functionality change.
Sebastian Redl [Thu, 8 Jul 2010 22:01:51 +0000 (22:01 +0000)]
Some preparatory work for chained PCH. No functionality change.

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

14 years agoMakes RecursiveASTVisitor traverse the type of a temporary object
Zhanyong Wan [Thu, 8 Jul 2010 21:01:29 +0000 (21:01 +0000)]
Makes RecursiveASTVisitor traverse the type of a temporary object
created via T() where T is a class type.  Reviewed by chandlerc and
csilvers.

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

14 years agoDuring code completion, give the "nil" and "NULL" macros the same
Douglas Gregor [Thu, 8 Jul 2010 20:55:51 +0000 (20:55 +0000)]
During code completion, give the "nil" and "NULL" macros the same
priority as other constants. And, if we're in a place where we prefer
a pointer type, consider "nil" and "NULL" to be close matches.

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

14 years agoAllow C-style casts and reinterpret_casts between block pointers and
Douglas Gregor [Thu, 8 Jul 2010 20:27:32 +0000 (20:27 +0000)]
Allow C-style casts and reinterpret_casts between block pointers and
either integer values or other pointers. Fixes <rdar://problem/8134521>.

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

14 years agoPR7588: Fix the _mm_shufflehi_epi16 macro. (The issue was an oversight
Eli Friedman [Thu, 8 Jul 2010 20:09:45 +0000 (20:09 +0000)]
PR7588: Fix the _mm_shufflehi_epi16 macro.  (The issue was an oversight
involving operator precedence.)

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

14 years agoHandle forward declarations properly in debug info.
Devang Patel [Thu, 8 Jul 2010 19:56:29 +0000 (19:56 +0000)]
Handle forward declarations properly in debug info.
Patch by Alexander Kabaev.
PR 7595.

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

14 years agoAdd missing whitespace.
Ted Kremenek [Thu, 8 Jul 2010 19:43:08 +0000 (19:43 +0000)]
Add missing whitespace.

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

14 years agoWhen performing substitution of template arguments within the body of
Douglas Gregor [Thu, 8 Jul 2010 18:37:38 +0000 (18:37 +0000)]
When performing substitution of template arguments within the body of
a template, be sure to include the template arguments from the
injected-class-name. Fixes PR7587.

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

14 years agoUpdate checker build.
Ted Kremenek [Thu, 8 Jul 2010 18:08:18 +0000 (18:08 +0000)]
Update checker build.

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

14 years agoIntroduce PCHReader::GetTranslationUnitDecl() and use it instead of ReadDeclRecord...
Argyrios Kyrtzidis [Thu, 8 Jul 2010 17:13:02 +0000 (17:13 +0000)]
Introduce PCHReader::GetTranslationUnitDecl() and use it instead of ReadDeclRecord when initializing.

ReadDeclRecord would hit assertion if the translation unit declaration was already loaded during
IdentifierInfo initialization.

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

14 years agoSupport TemplateTemplateParmDecl for PCH.
Argyrios Kyrtzidis [Thu, 8 Jul 2010 17:12:57 +0000 (17:12 +0000)]
Support TemplateTemplateParmDecl for PCH.

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

14 years agoBowing to popular demand, reduce the "comma at end of enumerator list"
Douglas Gregor [Thu, 8 Jul 2010 14:54:42 +0000 (14:54 +0000)]
Bowing to popular demand, reduce the "comma at end of enumerator list"
ExtWarn to an Extension. Let the broken code propagate!

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

14 years agoApparently the {{$}} hack doesn't work on Windows; I am saddened but not
John McCall [Thu, 8 Jul 2010 13:17:29 +0000 (13:17 +0000)]
Apparently the {{$}} hack doesn't work on Windows;  I am saddened but not
surprised.

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

14 years agoFor TagType and TemplateSpecializationType, isDependent calculation may be invalid...
Argyrios Kyrtzidis [Thu, 8 Jul 2010 13:09:53 +0000 (13:09 +0000)]
For TagType and TemplateSpecializationType, isDependent calculation may be invalid because some decls that the
calculation is using may still be initializing.
Thus, store the isDependent flag to PCH and restore directly to Type.

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

14 years agoRead/write the C++ parts of DeclRefExpr and MemberExpr for PCH.
Argyrios Kyrtzidis [Thu, 8 Jul 2010 13:09:47 +0000 (13:09 +0000)]
Read/write the C++ parts of DeclRefExpr and MemberExpr for PCH.

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

14 years agoFix reading of UsingDecl from PCH.
Argyrios Kyrtzidis [Thu, 8 Jul 2010 13:09:41 +0000 (13:09 +0000)]
Fix reading of UsingDecl from PCH.

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

14 years agoRemove unused protected constructor of DeclRefExpr.
Argyrios Kyrtzidis [Thu, 8 Jul 2010 13:09:35 +0000 (13:09 +0000)]
Remove unused protected constructor of DeclRefExpr.

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

14 years agoWrap the new ext-warn on extraneous comma on the last entry of an enumerator
Chandler Carruth [Thu, 8 Jul 2010 10:52:01 +0000 (10:52 +0000)]
Wrap the new ext-warn on extraneous comma on the last entry of an enumerator
list in a diagnostic group so it can be turned on and off. A terrifying amount
of code, including large chunks of open source code, still do this so it's
important to be able to suppress it when necessary.

Doug, is this a reasonable compromise? I'd lean toward making it a normal
extension, but I don't feel strongly as long as we can turn the warnings off.

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

14 years agoAdd support for differentiating between attributes ignored when handled and
Chandler Carruth [Thu, 8 Jul 2010 09:42:26 +0000 (09:42 +0000)]
Add support for differentiating between attributes ignored when handled and
unknown attributes that we discard. Add a diagnostic group for unknown
attribute warnings to allow turning these off when we don't care. Also
consolidates the tests for this case.

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

14 years agoTweak documentation to mention Debug+Asserts.
Duncan Sands [Thu, 8 Jul 2010 08:31:28 +0000 (08:31 +0000)]
Tweak documentation to mention Debug+Asserts.

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

14 years agoMark calls to 'throw()' functions as nounwind, and mark the functions nounwind
John McCall [Thu, 8 Jul 2010 06:48:12 +0000 (06:48 +0000)]
Mark calls to 'throw()' functions as nounwind, and mark the functions nounwind
as well.

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

14 years agoReinstate the fix for PR7556. A silly use of isTrivial() was
Douglas Gregor [Thu, 8 Jul 2010 06:14:04 +0000 (06:14 +0000)]
Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.

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

14 years agoallow this to pass on 32-bit hosts.
Chris Lattner [Thu, 8 Jul 2010 00:23:21 +0000 (00:23 +0000)]
allow this to pass on 32-bit hosts.

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

14 years agofix the clang side of PR7437: EmitAggregateCopy
Chris Lattner [Thu, 8 Jul 2010 00:07:45 +0000 (00:07 +0000)]
fix the clang side of PR7437: EmitAggregateCopy
was not producing a memcpy with the right address
spaces because of two places in it doing casts of
the arguments to i8, one of which that didn't
preserve the address space.

There is also an optimizer bug here.

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

14 years agofilecheckize this test.
Chris Lattner [Thu, 8 Jul 2010 00:05:45 +0000 (00:05 +0000)]
filecheckize this test.

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

14 years agoFix a few errors in the internals doc.
Sebastian Redl [Wed, 7 Jul 2010 23:42:27 +0000 (23:42 +0000)]
Fix a few errors in the internals doc.

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

14 years agoRevert r107828 and r107827, the fix for PR7556, which seems to be
Douglas Gregor [Wed, 7 Jul 2010 23:37:33 +0000 (23:37 +0000)]
Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.

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

14 years agofix PR4499, patch by Kyle Dean!
Chris Lattner [Wed, 7 Jul 2010 23:24:27 +0000 (23:24 +0000)]
fix PR4499, patch by Kyle Dean!

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

14 years agoRip out the C++0x-specific handling of destructor names. The specification is still...
Sebastian Redl [Wed, 7 Jul 2010 23:17:38 +0000 (23:17 +0000)]
Rip out the C++0x-specific handling of destructor names. The specification is still in flux and unclear, and our interim workaround was broken. Fixes PR7467.

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

14 years agoA using declaration can redeclare a typedef to the same type. These
Douglas Gregor [Wed, 7 Jul 2010 23:08:52 +0000 (23:08 +0000)]
A using declaration can redeclare a typedef to the same type. These
typedefs won't have the same canonical declaration (since they are
distinct), so we need to check for this case specifically. Fixes
<rdar://problem/8018262>.

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

14 years agoRename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
Douglas Gregor [Wed, 7 Jul 2010 22:43:56 +0000 (22:43 +0000)]
Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
newly-narrowed scope. No functionality change.

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

14 years agoDo not use CXXZeroValueInitExpr for class types. Instead, use
Douglas Gregor [Wed, 7 Jul 2010 22:35:13 +0000 (22:35 +0000)]
Do not use CXXZeroValueInitExpr for class types. Instead, use
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.

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

14 years agoFix an issue with opencl init list checking.
Nate Begeman [Wed, 7 Jul 2010 22:26:56 +0000 (22:26 +0000)]
Fix an issue with opencl init list checking.

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

14 years agoChanges how the TypeLoc traverser invokes the Type traverser: before,
Zhanyong Wan [Wed, 7 Jul 2010 21:36:58 +0000 (21:36 +0000)]
Changes how the TypeLoc traverser invokes the Type traverser: before,
VisitFooTypeLoc() calls VisitFooType(); now, TraverseFooTypeLoc()
calls WalkUpFromFooType(). This allows clients that override
WalkUpFromFooType() to continue to work.  It also preserves the
property that Visit*() in the base visitor class is a no-op (s.t. a
subclass doesn't have to call Base::Visit*() when overriding
Visit*()).

Also fixes some typos in comments.

Also added a missing getDerived() inside
TraverseQualifiedTypeLoc(). The call is needed in case a subclass
overrides TraverseTypeLoc().

Reviewed by nlewycky and csilvers.

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

14 years agoWhen printing statistics for the ASTContext, also print them for its BumpPtrAllocator
Douglas Gregor [Wed, 7 Jul 2010 16:40:34 +0000 (16:40 +0000)]
When printing statistics for the ASTContext, also print them for its BumpPtrAllocator

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

14 years agoadd driver support for minix, patch by Kees van Reeuwijk
Chris Lattner [Wed, 7 Jul 2010 16:01:42 +0000 (16:01 +0000)]
add driver support for minix, patch by Kees van Reeuwijk
from PR7583

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

14 years agoFix broken reading of NestedNameSpecifiers from PCH.
Argyrios Kyrtzidis [Wed, 7 Jul 2010 15:46:30 +0000 (15:46 +0000)]
Fix broken reading of NestedNameSpecifiers from PCH.

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

14 years agoDelay passing InterestingDecls to the Consumer until when we know we are not in recur...
Argyrios Kyrtzidis [Wed, 7 Jul 2010 15:46:26 +0000 (15:46 +0000)]
Delay passing InterestingDecls to the Consumer until when we know we are not in recursive loading and the
declarations are fully initialized.

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

14 years agogetBody() -> hasBody()
Argyrios Kyrtzidis [Wed, 7 Jul 2010 12:24:18 +0000 (12:24 +0000)]
getBody() -> hasBody()

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

14 years agoSimplify code and remove comment that is no longer relevant.
Argyrios Kyrtzidis [Wed, 7 Jul 2010 12:24:14 +0000 (12:24 +0000)]
Simplify code and remove comment that is no longer relevant.

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

14 years agoRemove Decl::getCompoundBody().
Argyrios Kyrtzidis [Wed, 7 Jul 2010 11:31:34 +0000 (11:31 +0000)]
Remove Decl::getCompoundBody().

This has 2 (slight) advantages:
-Make explicit at getBody()'s callsite that we expect/handle only CompoundStmt and not CXXTryStmt.
-Better tracking of Decl::getBody()'s callsites.

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

14 years agoSimplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.
Argyrios Kyrtzidis [Wed, 7 Jul 2010 11:31:27 +0000 (11:31 +0000)]
Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.

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

14 years agoSimplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.
Argyrios Kyrtzidis [Wed, 7 Jul 2010 11:31:23 +0000 (11:31 +0000)]
Simplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.

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

14 years agoIntroduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead of getBody...
Argyrios Kyrtzidis [Wed, 7 Jul 2010 11:31:19 +0000 (11:31 +0000)]
Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH.

Makes de-serialization of the function body even more "lazier".

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

14 years agoAdd memcmp() and bcmp() to CStringChecker. These check for valid access to the buffer...
Jordy Rose [Wed, 7 Jul 2010 08:15:01 +0000 (08:15 +0000)]
Add memcmp() and bcmp() to CStringChecker. These check for valid access to the buffer arguments and have a special-case for when the buffer arguments are known to be the same address, or when the size is zero.

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

14 years agoA Release-Asserts build is now called a Release build.
Duncan Sands [Wed, 7 Jul 2010 07:49:17 +0000 (07:49 +0000)]
A Release-Asserts build is now called a Release build.

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

14 years agoCleanup on CStringChecker and its associated tests. Also check for null arguments...
Jordy Rose [Wed, 7 Jul 2010 07:48:06 +0000 (07:48 +0000)]
Cleanup on CStringChecker and its associated tests. Also check for null arguments...which are allowed if the access length is 0!

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

14 years agoTeach function-try-blocks on constructors and destructors to implicitly
John McCall [Wed, 7 Jul 2010 06:56:46 +0000 (06:56 +0000)]
Teach function-try-blocks on constructors and destructors to implicitly
rethrow.  Fixes rdar://problem/7696603

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

14 years agoimplement PR7569, warning about assignment to null, which
Chris Lattner [Wed, 7 Jul 2010 06:14:23 +0000 (06:14 +0000)]
implement PR7569, warning about assignment to null, which
people seem to write when they want a deterministic trap.
Suggest instead that they use a volatile pointer or
__builtin_trap.

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

14 years agoDon't consider casted non-global pointers to be evaluatable.
John McCall [Wed, 7 Jul 2010 05:08:32 +0000 (05:08 +0000)]
Don't consider casted non-global pointers to be evaluatable.
Fixes rdar://problem/8154689

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

14 years agoAvoid double-traversing for QualifiedTypeLoc -- we were calling
Craig Silverstein [Wed, 7 Jul 2010 04:38:11 +0000 (04:38 +0000)]
Avoid double-traversing for QualifiedTypeLoc -- we were calling
VisitTypeLoc twice for qualified types, once for the qualified form
and once for the unqualified (though they looked the same by the time
we got to visittypeloc).  Now only visit once, which matches previous
behavior.

Reviewed by nlewycky

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

14 years agoChange explicit handling of impossible condition to call llvm_unreachable in Idempote...
Tom Care [Wed, 7 Jul 2010 01:27:17 +0000 (01:27 +0000)]
Change explicit handling of impossible condition to call llvm_unreachable in IdempotentOperationChecker::PreVisitBinaryOperator.

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

14 years agoSilence an annoying GCC warning about use of an uninitialized variable. Even
Chandler Carruth [Wed, 7 Jul 2010 00:36:56 +0000 (00:36 +0000)]
Silence an annoying GCC warning about use of an uninitialized variable. Even
making the other switch case unreachable, or sinking the 'continue' into it
doesn't silence this.

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

14 years agoUse 'llvm_unreachable' to mark impossible code paths so that GCC doesn't
Chandler Carruth [Wed, 7 Jul 2010 00:07:37 +0000 (00:07 +0000)]
Use 'llvm_unreachable' to mark impossible code paths so that GCC doesn't
consider them for warnings.

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

14 years agoProvide a hook for the benefit of clients using clang IR gen as a subroutine:
John McCall [Tue, 6 Jul 2010 23:57:41 +0000 (23:57 +0000)]
Provide a hook for the benefit of clients using clang IR gen as a subroutine:
emit metadata associating allocas and global values with a Decl*.  This feature
is controlled by an option that (intentionally) cannot be enabled on the command
line.

To use this feature, simply set
  CodeGenOptions.EmitDeclMetadata = true;
and then interpret the completely underspecified metadata. :)

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

14 years agoFix casts in RegionStore to not always assume that bindings are only to SubRegions...
Ted Kremenek [Tue, 6 Jul 2010 23:53:29 +0000 (23:53 +0000)]
Fix casts in RegionStore to not always assume that bindings are only to SubRegions.  Fixes assertion failure
reported in PR 7572.

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

14 years agoAdd a const version of a method, to be consistent with other methods
Craig Silverstein [Tue, 6 Jul 2010 23:51:34 +0000 (23:51 +0000)]
Add a const version of a method, to be consistent with other methods
of the same type.  I think this was just an oversight before.

Reviewed by chandlerc.  Submitted as an "obvious" fix.

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

14 years agoFix idempotent operations test command line arguments.
Tom Care [Tue, 6 Jul 2010 23:47:26 +0000 (23:47 +0000)]
Fix idempotent operations test command line arguments.

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

14 years agoImplement dumpToStream() for NonStaticGlobalSpaceRegion and StaticGlobalSpaceRegion.
Ted Kremenek [Tue, 6 Jul 2010 23:37:21 +0000 (23:37 +0000)]
Implement dumpToStream() for NonStaticGlobalSpaceRegion and StaticGlobalSpaceRegion.

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

14 years agoAdd comment noting VLASizeChecker's duty in defining a VLA's extent.
Jordy Rose [Tue, 6 Jul 2010 23:33:54 +0000 (23:33 +0000)]
Add comment noting VLASizeChecker's duty in defining a VLA's extent.

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

14 years agoAdd a new path-sensitive checker for functions in <string.h>, for both null-terminate...
Jordy Rose [Tue, 6 Jul 2010 23:11:01 +0000 (23:11 +0000)]
Add a new path-sensitive checker for functions in <string.h>, for both null-terminated strings and memory blocks. Currently only checks memcpy(), memmove(), and bcopy(), but this is intended to be expanded soon.

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

14 years agoSort CMake file.
Ted Kremenek [Tue, 6 Jul 2010 22:03:19 +0000 (22:03 +0000)]
Sort CMake file.

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

14 years agoAdded a path-sensitive idempotent operation checker (-analyzer-idempotent-operation...
Tom Care [Tue, 6 Jul 2010 21:43:29 +0000 (21:43 +0000)]
Added a path-sensitive idempotent operation checker (-analyzer-idempotent-operation). Finds idempotent and/or tautological operations in a path sensitive context, flagging operations that have no effect or a predictable effect.

Example:
{
int a = 1;
int b = 5;
int c = b / a; // a is 1 on all paths
}

- New IdempotentOperationChecker class
- Moved recursive Stmt functions in r107675 to IdempotentOperationChecker
- Minor refactoring of SVal to allow checking for any integer
- Added command line option for check
- Added basic test cases

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

14 years agoFix multiple emission of the this-> fixit for each instantiation by fixing the
Nick Lewycky [Tue, 6 Jul 2010 19:51:49 +0000 (19:51 +0000)]
Fix multiple emission of the this-> fixit for each instantiation by fixing the
AST during the instantiation. Fixes PR7417!

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

14 years agoMake CGBuilderTy a typedef again; its functionality has been rolled back
John McCall [Tue, 6 Jul 2010 18:43:48 +0000 (18:43 +0000)]
Make CGBuilderTy a typedef again;  its functionality has been rolled back
into IRBuilder.

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

14 years agoImprove the accuracy of getSourceRange() for DeclaratorDecl and
Douglas Gregor [Tue, 6 Jul 2010 18:42:40 +0000 (18:42 +0000)]
Improve the accuracy of getSourceRange() for DeclaratorDecl and
TagDecl subclasses when out-of-line template declaration information
is available, from Peter Collingbourne!

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

14 years agoCorrectly set the location of the "template" keyword for a class
Douglas Gregor [Tue, 6 Jul 2010 18:33:12 +0000 (18:33 +0000)]
Correctly set the location of the "template" keyword for a class
template specialization, from Peter Collingbourne.

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

14 years agoRemove my egregious hack that forced deserialization of visible
Douglas Gregor [Tue, 6 Jul 2010 18:29:01 +0000 (18:29 +0000)]
Remove my egregious hack that forced deserialization of visible
declarations when implicitly declaring the default constructor, copy
constructor, destructor, and copy-assignment operators of a
class. Argiris fixed the underlying problem in r107596.

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

14 years agoPacify versions of gcc that think these variables may be used
Duncan Sands [Tue, 6 Jul 2010 18:19:40 +0000 (18:19 +0000)]
Pacify versions of gcc that think these variables may be used
uninitialized (which doesn't seem to be the case), by giving
them arbitrary initial values.

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

14 years agoWhen destroying a cleanup, kill any references to instructions in the entry
John McCall [Tue, 6 Jul 2010 17:35:03 +0000 (17:35 +0000)]
When destroying a cleanup, kill any references to instructions in the entry
block before deleting it.  Fixes PR7575.

This really just a short-term fix before implementing lazy cleanups.

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

14 years agoAdded several helper functions to Stmt to recursively check for different elements...
Tom Care [Tue, 6 Jul 2010 17:28:49 +0000 (17:28 +0000)]
Added several helper functions to Stmt to recursively check for different elements (macros, enum constants, etc).

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

14 years agoRead/write function template specializations for PCH, properly this time.
Argyrios Kyrtzidis [Tue, 6 Jul 2010 15:37:09 +0000 (15:37 +0000)]
Read/write function template specializations for PCH, properly this time.

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

14 years agoAdd to PCH missing Sema information about VTable uses and dynamic classes.
Argyrios Kyrtzidis [Tue, 6 Jul 2010 15:37:04 +0000 (15:37 +0000)]
Add to PCH missing Sema information about VTable uses and dynamic classes.

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

14 years agoAllow a CXXRecordDecl to get a DefinitionData pointer even when its owner is still...
Argyrios Kyrtzidis [Tue, 6 Jul 2010 15:36:58 +0000 (15:36 +0000)]
Allow a CXXRecordDecl to get a DefinitionData pointer even when its owner is still initializing.

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

14 years agoRead/write instantiated-from-member of EnumDecl for PCH.
Argyrios Kyrtzidis [Tue, 6 Jul 2010 15:36:48 +0000 (15:36 +0000)]
Read/write instantiated-from-member of EnumDecl for PCH.

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

14 years agoAdd skeleton code to make wpa call the analysis engine.
Zhongxing Xu [Tue, 6 Jul 2010 09:18:02 +0000 (09:18 +0000)]
Add skeleton code to make wpa call the analysis engine.

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

14 years agoAdd an assertion.
Zhongxing Xu [Tue, 6 Jul 2010 07:08:47 +0000 (07:08 +0000)]
Add an assertion.

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

14 years agoCollect function definitions in the Indexer when indexing through the ASTs.
Zhongxing Xu [Tue, 6 Jul 2010 05:55:13 +0000 (05:55 +0000)]
Collect function definitions in the Indexer when indexing through the ASTs.
Add an API to get an Entity associated with a name in the global namespace.

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

14 years agoWhen creating functions to run global initializers and destructors, mark them
John McCall [Tue, 6 Jul 2010 04:38:10 +0000 (04:38 +0000)]
When creating functions to run global initializers and destructors, mark them
as nounwind in -fno-exceptions.  Fixes rdar://problem/8090834.

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

14 years agoRemove the now-unused GRState::isEqual method. Instead of asking if an expression...
Jordy Rose [Tue, 6 Jul 2010 04:12:24 +0000 (04:12 +0000)]
Remove the now-unused GRState::isEqual method. Instead of asking if an expression equals a certain value, use SValuator::EvalEQ and GRState::Assume to see if it can, must, or must not equal that value.

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

14 years agoOops, tabs --> spaces in test.
Jordy Rose [Tue, 6 Jul 2010 02:42:09 +0000 (02:42 +0000)]
Oops, tabs --> spaces in test.

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

14 years agoImprove NULL-checking for CFRetain/CFRelease. We now remember that the argument was...
Jordy Rose [Tue, 6 Jul 2010 02:34:42 +0000 (02:34 +0000)]
Improve NULL-checking for CFRetain/CFRelease. We now remember that the argument was non-NULL, and we report where the null assumption came from (like AttrNonNullChecker already did).

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

14 years agoStop testing for specific basic block numbers in this test.
John McCall [Tue, 6 Jul 2010 02:14:28 +0000 (02:14 +0000)]
Stop testing for specific basic block numbers in this test.

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

14 years agoValidated by nightly-test runs on x86 and x86-64 darwin, including after
John McCall [Tue, 6 Jul 2010 01:34:17 +0000 (01:34 +0000)]
Validated by nightly-test runs on x86 and x86-64 darwin, including after
self-host.  Hopefully these results hold up on different platforms.

I tried to keep the GNU ObjC runtime happy, but it's hard for me to test.
Reimplement how clang generates IR for exceptions.  Instead of creating new
invoke destinations which sequentially chain to the previous destination,
push a more semantic representation of *why* we need the cleanup/catch/filter
behavior, then collect that information into a single landing pad upon request.

Also reorganizes how normal cleanups (i.e. cleanups triggered by non-exceptional
control flow) are generated, since it's actually fairly closely tied in with
the former.  Remove the need to track which cleanup scope a block is associated
with.

Document a lot of previously poorly-understood (by me, at least) behavior.

The new framework implements the Horrible Hack (tm), which requires every
landing pad to have a catch-all so that inlining will work.  Clang no longer
requires the Horrible Hack just to make exceptions flow correctly within
a function, however.  The HH is an unfortunate requirement of LLVM's EH IR.

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

14 years agoLocal variables have no linkage, make invalid Entities.
Zhongxing Xu [Tue, 6 Jul 2010 01:20:49 +0000 (01:20 +0000)]
Local variables have no linkage, make invalid Entities.

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

14 years agoGenerate fewer first class aggregate values for other
Chris Lattner [Mon, 5 Jul 2010 20:41:41 +0000 (20:41 +0000)]
Generate fewer first class aggregate values for other
coerce cases (e.g. {double,int}) which avoids fastisel
bailing out at -O0.

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

14 years agoin the "coerce" case, the ABI handling code ends up making the
Chris Lattner [Mon, 5 Jul 2010 20:21:00 +0000 (20:21 +0000)]
in the "coerce" case, the ABI handling code ends up making the
alloca for an argument.  Make sure the argument gets the proper
decl alignment, which may be different than the type alignment.

This fixes PR7567

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

14 years agofix a bug I introduced in r107624
Chris Lattner [Mon, 5 Jul 2010 19:36:34 +0000 (19:36 +0000)]
fix a bug I introduced in r107624

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

14 years agorearrange some logic, no functionality change.
Chris Lattner [Mon, 5 Jul 2010 19:17:26 +0000 (19:17 +0000)]
rearrange some logic, no functionality change.

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

14 years agofix PR7564 a cast where the bitfield struct init code
Chris Lattner [Mon, 5 Jul 2010 18:03:30 +0000 (18:03 +0000)]
fix PR7564 a cast where the bitfield struct init code
wasn't handling array padding elements right.

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

14 years agoAppendBitField really can never fail, so return its return value.
Chris Lattner [Mon, 5 Jul 2010 17:04:23 +0000 (17:04 +0000)]
AppendBitField really can never fail, so return its return value.
Everyone knows that no bugs are ever possible with bitfields.

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

14 years agoRead/write the identifier namespace in PCH for decls that may modify it.
Argyrios Kyrtzidis [Mon, 5 Jul 2010 10:38:01 +0000 (10:38 +0000)]
Read/write the identifier namespace in PCH for decls that may modify it.

We can now use a PCH'ed <map>.

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