]> granicus.if.org Git - clang/log
clang
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

14 years agoRead/write some source location for PCH.
Argyrios Kyrtzidis [Mon, 5 Jul 2010 10:37:55 +0000 (10:37 +0000)]
Read/write some source location for PCH.

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

14 years agoSupport sizeof for VLA expressions (sizeof(someVLA)). sizeof(int[n]) still unimplemen...
Jordy Rose [Mon, 5 Jul 2010 04:42:43 +0000 (04:42 +0000)]
Support sizeof for VLA expressions (sizeof(someVLA)). sizeof(int[n]) still unimplemented. A VLA region's sizeof value matches its extent.

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

14 years agoRefrase comments.
Zhongxing Xu [Mon, 5 Jul 2010 02:36:16 +0000 (02:36 +0000)]
Refrase comments.

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

14 years agoAlthough in C++ class name has external linkage, usually the definition of the
Zhongxing Xu [Mon, 5 Jul 2010 02:35:40 +0000 (02:35 +0000)]
Although in C++ class name has external linkage, usually the definition of the
class is available in the same translation unit when it's needed. So we make
all of them invalid Entity.

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

14 years agoMake FieldDecl an invalid Entity since it has no linkage.
Zhongxing Xu [Mon, 5 Jul 2010 02:31:16 +0000 (02:31 +0000)]
Make FieldDecl an invalid Entity since it has no linkage.

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

14 years agoIndexer: make FieldDecl an internal Entity.
Zhongxing Xu [Mon, 5 Jul 2010 01:44:14 +0000 (01:44 +0000)]
Indexer: make FieldDecl an internal Entity.

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

14 years agoTrack extents for VLAs.
Jordy Rose [Mon, 5 Jul 2010 00:50:15 +0000 (00:50 +0000)]
Track extents for VLAs.

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

14 years agoFix a regression of a previous commit of mine (rdar://8158953).
Argyrios Kyrtzidis [Sun, 4 Jul 2010 21:44:47 +0000 (21:44 +0000)]
Fix a regression of a previous commit of mine (rdar://8158953).

Some of the invariant checks for creating Record/Enum types don't hold true during PCH reading.
Introduce more suitable ASTContext::getRecordType() and getEnumType().

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

14 years agoRead/write more information of ASTContext for PCH. Overriden methods and instantiated...
Argyrios Kyrtzidis [Sun, 4 Jul 2010 21:44:35 +0000 (21:44 +0000)]
Read/write more information of ASTContext for PCH. Overriden methods and instantiated-from information.

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

14 years agoWhen adding a visible decl, deserialize the visible decls and add it.
Argyrios Kyrtzidis [Sun, 4 Jul 2010 21:44:25 +0000 (21:44 +0000)]
When adding a visible decl, deserialize the visible decls and add it.

Before this commit, visible decls added before deserialization were ignored.
This was not an issue since name lookup (that usually comes before the addition) forces deserialization
but it is an issue for lazily declared class implicit members.

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

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

14 years agoDon't try to install the __[u]int128_t identifier if it is already installed by PCHRe...
Argyrios Kyrtzidis [Sun, 4 Jul 2010 21:44:19 +0000 (21:44 +0000)]
Don't try to install the __[u]int128_t identifier if it is already installed by PCHReader.

Currently, adding it to visible decls of a PCH'ed translation unit has no effect because
adding visible decls before deserialization has no effect (the decls won't be visible).
This will be fixed in a future commit; then it will force deserialization of visible decls, so avoid pointlessly installing it.

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

14 years agoWrite/read ParmVarDecl's UninstantiatedDefaultArg for PCH.
Argyrios Kyrtzidis [Sun, 4 Jul 2010 21:44:07 +0000 (21:44 +0000)]
Write/read ParmVarDecl's UninstantiatedDefaultArg for PCH.

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

14 years agoRead/write specialization info of static data members for PCH.
Argyrios Kyrtzidis [Sun, 4 Jul 2010 21:44:00 +0000 (21:44 +0000)]
Read/write specialization info of static data members for PCH.

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

14 years agoAdd TypeLoc traversal to the RecursiveASTVisitor! Because the TypeLocs don't
Nick Lewycky [Sun, 4 Jul 2010 21:29:45 +0000 (21:29 +0000)]
Add TypeLoc traversal to the RecursiveASTVisitor! Because the TypeLocs don't
contain all the same information that their Types do, we will fall back to
traversing the Types instead. The default TypeLoc visitor calls the matching
Type visitor so that existing clients should continue to work with no change.

Also adds element traversal to the ExtVectorType.

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

14 years agoFix ObjCInterfaceTypeLoc to inherit from ObjCObjectTypeLoc so as to match the
Nick Lewycky [Sun, 4 Jul 2010 01:41:30 +0000 (01:41 +0000)]
Fix ObjCInterfaceTypeLoc to inherit from ObjCObjectTypeLoc so as to match the
Type hierarchy. Without this, TypeLocNodes.def will give you wrong type
hierarchy information (claiming that ObjCObjectTypeLoc is the base of
ObjCInterfaceTypeLoc, which it wasn't).

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

14 years agoAdd a new symbol type, SymbolExtent, to represent the extents of memory regions that...
Jordy Rose [Sun, 4 Jul 2010 00:00:41 +0000 (00:00 +0000)]
Add a new symbol type, SymbolExtent, to represent the extents of memory regions that may not be known at compile-time (such as those created by malloc). This replaces the old setExtent/getExtent API on Store, which used the GRState's GDM to store SVals.

Also adds a getKnownValue() method to SValuator, which gets the integer value of an SVal if it is known to only have one possible value. There are more places in the code that could be using this, but in general we want to be dealing entirely in SVals, so its usefulness is limited.

The only visible functionality change is that extents are now honored for any DeclRegion, such as fields and Objective-C ivars, rather than just variables. This shows up in bounds-checking and cast-size-checking.

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

14 years agoUnbreak test on platforms where size_t != unsigned long.
Benjamin Kramer [Sat, 3 Jul 2010 20:33:13 +0000 (20:33 +0000)]
Unbreak test on platforms where size_t != unsigned long.

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

14 years agoMark the operator delete associated with a virtual destructor as referenced.
John McCall [Sat, 3 Jul 2010 18:33:00 +0000 (18:33 +0000)]
Mark the operator delete associated with a virtual destructor as referenced.

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

14 years agoMangle Objective-C pointers and block pointers in the Microsoft C++ Mangler.
Charles Davis [Sat, 3 Jul 2010 16:56:59 +0000 (16:56 +0000)]
Mangle Objective-C pointers and block pointers in the Microsoft C++ Mangler.

ObjC pointers were easy enough (as far as the ABI is concerned, they're
just pointers to structs), but I had to invent a new mangling for block
pointers. This is particularly worrying with the Microsoft ABI, because
it is a vendor-specific ABI; extending it could come back to bite us
later when MS extends it on their own (and you know they will).

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

14 years agoProvide convenience routines to save and restore the current insertion
John McCall [Sat, 3 Jul 2010 09:25:20 +0000 (09:25 +0000)]
Provide convenience routines to save and restore the current insertion
point.

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

14 years agoFix mangling of array dimensions in the Microsoft C++ Mangler.
Charles Davis [Sat, 3 Jul 2010 08:15:16 +0000 (08:15 +0000)]
Fix mangling of array dimensions in the Microsoft C++ Mangler.

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

14 years agoMangle member pointer types in the Microsoft C++ Mangler.
Charles Davis [Sat, 3 Jul 2010 08:01:32 +0000 (08:01 +0000)]
Mangle member pointer types in the Microsoft C++ Mangler.

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

14 years agoWhen setting the anonymous namespace at PCH reading, it may still be initializing...
Argyrios Kyrtzidis [Sat, 3 Jul 2010 07:57:53 +0000 (07:57 +0000)]
When setting the anonymous namespace at PCH reading, it may still be initializing so avoid
the invariant checks at NamespaceDecl::setAnonymousNamespace().

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

14 years agoFix mangling of function pointers in the Microsoft C++ Mangler.
Charles Davis [Sat, 3 Jul 2010 05:53:41 +0000 (05:53 +0000)]
Fix mangling of function pointers in the Microsoft C++ Mangler.

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

14 years agoForward -fno-builtin to clang, add .cp as a supported
Shantonu Sen [Sat, 3 Jul 2010 03:08:23 +0000 (03:08 +0000)]
Forward -fno-builtin to clang, add .cp as a supported
extension if you otherwise configure scan-build
to do c++ static analysis.

OKed by Ted

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

14 years agoFix mangling of array parameters for functions in the Microsoft C++ Mangler.
Charles Davis [Sat, 3 Jul 2010 02:41:45 +0000 (02:41 +0000)]
Fix mangling of array parameters for functions in the Microsoft C++ Mangler.
Only actual functions get mangled correctly; I don't know how to fix it for
function pointers yet. Thanks to John McCall for the hint.

Also, mangle anonymous tag types. I don't have a suitable testcase yet; I have
a feeling that that's going to need support for static locals, and I haven't
figured out exactly how MSVC's scheme for mangling those works.

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

14 years agoLazily declare default constructors. We now delay the construction of
Douglas Gregor [Sat, 3 Jul 2010 00:47:00 +0000 (00:47 +0000)]
Lazily declare default constructors. We now delay the construction of
declarations for implicit default constructors, copy constructors,
copy assignment operators, and destructors. On a "simple" translation
unit that includes a bunch of C++ standard library headers, we
generate relatively few of these implicit declarations now:

  4/159 implicit default constructors created
  18/236 implicit copy constructors created
  70/241 implicit copy assignment operators created
  0/173 implicit destructors created

And, on this translation unit, this optimization doesn't really
provide any benefit. I'll do some more performance measurements soon,
but this completes the implementation work for <rdar://problem/8151045>.

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

14 years agoLazily declare implicit copy constructors.
Douglas Gregor [Fri, 2 Jul 2010 23:41:54 +0000 (23:41 +0000)]
Lazily declare implicit copy constructors.

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

14 years agoRead/write CastExpr's CXXBaseSpecifierArray for PCH.
Argyrios Kyrtzidis [Fri, 2 Jul 2010 23:30:27 +0000 (23:30 +0000)]
Read/write CastExpr's CXXBaseSpecifierArray for PCH.

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

14 years agoFix broken PCH support for CXXDefaultArgExpr.
Argyrios Kyrtzidis [Fri, 2 Jul 2010 23:30:15 +0000 (23:30 +0000)]
Fix broken PCH support for CXXDefaultArgExpr.

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

14 years agoIntroduce a new routine, LookupConstructors(), and use it for all
Douglas Gregor [Fri, 2 Jul 2010 23:12:18 +0000 (23:12 +0000)]
Introduce a new routine, LookupConstructors(), and use it for all
constructor-name lookup.

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

14 years agoLazily declare copy-assignment operators.
Douglas Gregor [Fri, 2 Jul 2010 21:50:04 +0000 (21:50 +0000)]
Lazily declare copy-assignment operators.

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

14 years agoMake RecursiveASTVisitor traverse function parameter types in a function
Zhanyong Wan [Fri, 2 Jul 2010 21:02:30 +0000 (21:02 +0000)]
Make RecursiveASTVisitor traverse function parameter types in a function
prototype declaration.  Reviewed by chandlerc and csilvers.

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

14 years agoLazily declare the implicitly-declared destructor in a C++ class.
Douglas Gregor [Fri, 2 Jul 2010 20:37:36 +0000 (20:37 +0000)]
Lazily declare the implicitly-declared destructor in a C++ class.

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

14 years agoDon't visit implicitly defined functions (default constructors and the
Craig Silverstein [Fri, 2 Jul 2010 19:07:50 +0000 (19:07 +0000)]
Don't visit implicitly defined functions (default constructors and the
like).  Our goal with this visitor is to visit exactly what people type.

Reviewed by chandlerc.

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

14 years agoMove the "current scope" state from the Parser into Action. This
Douglas Gregor [Fri, 2 Jul 2010 17:43:08 +0000 (17:43 +0000)]
Move the "current scope" state from the Parser into Action. This
allows Sema some limited access to the current scope, which we only
use in one way: when Sema is performing some kind of declaration that
is not directly driven by the parser (e.g., due to template
instantiatio or lazy declaration of a member), we can find the Scope
associated with a DeclContext, if that DeclContext is still in the
process of being parsed.

Use this to make the implicit declaration of special member functions
in a C++ class more "scope-less", rather than using the NULL Scope hack.

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

14 years agoBy default, warn about commas at the end of an enumerator list in C++/C89.
Douglas Gregor [Fri, 2 Jul 2010 16:17:01 +0000 (16:17 +0000)]
By default, warn about commas at the end of an enumerator list in C++/C89.

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

14 years agoHandle CXXConstructorDecl, CXXDestructorDecl, and CXXConversionDecl for PCH.
Argyrios Kyrtzidis [Fri, 2 Jul 2010 15:58:43 +0000 (15:58 +0000)]
Handle CXXConstructorDecl, CXXDestructorDecl, and CXXConversionDecl for PCH.

<vector> header can be used correctly through PCH now.

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

14 years agoProvide some test cases for C++ PCH.
Argyrios Kyrtzidis [Fri, 2 Jul 2010 11:55:48 +0000 (11:55 +0000)]
Provide some test cases for C++ PCH.

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

14 years agoDisable Decl::CheckAccessDeclContext() temporarily.
Argyrios Kyrtzidis [Fri, 2 Jul 2010 11:55:44 +0000 (11:55 +0000)]
Disable Decl::CheckAccessDeclContext() temporarily.

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