Douglas Gregor
9961ce9428
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.
llvm-svn: 107895
2010-07-08 18:37:38 +00:00
Ted Kremenek
30ae68bd17
Update checker build.
...
llvm-svn: 107893
2010-07-08 18:08:18 +00:00
Argyrios Kyrtzidis
7e8996c7e6
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.
llvm-svn: 107885
2010-07-08 17:13:02 +00:00
Argyrios Kyrtzidis
9f2d24a808
Support TemplateTemplateParmDecl for PCH.
...
llvm-svn: 107884
2010-07-08 17:12:57 +00:00
Douglas Gregor
f609386058
Bowing to popular demand, reduce the "comma at end of enumerator list"
...
ExtWarn to an Extension. Let the broken code propagate!
llvm-svn: 107875
2010-07-08 14:54:42 +00:00
John McCall
b5081aff68
Apparently the {{$}} hack doesn't work on Windows; I am saddened but not
...
surprised.
llvm-svn: 107874
2010-07-08 13:17:29 +00:00
Argyrios Kyrtzidis
a4ed18191c
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.
llvm-svn: 107873
2010-07-08 13:09:53 +00:00
Argyrios Kyrtzidis
1985bb3b10
Read/write the C++ parts of DeclRefExpr and MemberExpr for PCH.
...
llvm-svn: 107872
2010-07-08 13:09:47 +00:00
Argyrios Kyrtzidis
00dda6accc
Fix reading of UsingDecl from PCH.
...
llvm-svn: 107871
2010-07-08 13:09:41 +00:00
Argyrios Kyrtzidis
ab446e1b57
Remove unused protected constructor of DeclRefExpr.
...
llvm-svn: 107870
2010-07-08 13:09:35 +00:00
Chandler Carruth
e51a119fc6
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.
llvm-svn: 107865
2010-07-08 10:52:01 +00:00
Chandler Carruth
dd1bc0f1b5
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.
llvm-svn: 107864
2010-07-08 09:42:26 +00:00
Duncan Sands
b69d4ce5f3
Tweak documentation to mention Debug+Asserts.
...
llvm-svn: 107863
2010-07-08 08:31:28 +00:00
John McCall
be349def4b
Mark calls to 'throw()' functions as nounwind, and mark the functions nounwind
...
as well.
llvm-svn: 107858
2010-07-08 06:48:12 +00:00
Douglas Gregor
747eb7840a
Reinstate the fix for PR7556. A silly use of isTrivial() was
...
suppressing copies of objects with trivial copy constructors.
llvm-svn: 107857
2010-07-08 06:14:04 +00:00
Chris Lattner
06801d7371
allow this to pass on 32-bit hosts.
...
llvm-svn: 107845
2010-07-08 00:23:21 +00:00
Chris Lattner
cb7696cf35
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.
llvm-svn: 107842
2010-07-08 00:07:45 +00:00
Chris Lattner
26b1a19842
filecheckize this test.
...
llvm-svn: 107841
2010-07-08 00:05:45 +00:00
Sebastian Redl
bbace2a63d
Fix a few errors in the internals doc.
...
llvm-svn: 107838
2010-07-07 23:42:27 +00:00
Douglas Gregor
e182370eda
Revert r107828 and r107827, the fix for PR7556, which seems to be
...
breaking bootstrap on Linux.
llvm-svn: 107837
2010-07-07 23:37:33 +00:00
Chris Lattner
86851b8a7a
fix PR4499, patch by Kyle Dean!
...
llvm-svn: 107836
2010-07-07 23:24:27 +00:00
Sebastian Redl
a771d2239d
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.
...
llvm-svn: 107835
2010-07-07 23:17:38 +00:00
Douglas Gregor
1d9ef840fa
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>.
llvm-svn: 107833
2010-07-07 23:08:52 +00:00
Douglas Gregor
6df2b8c3ac
Rename CXXZeroInitValueExpr to CXXScalarValueInitExpr, to reflect its
...
newly-narrowed scope. No functionality change.
llvm-svn: 107828
2010-07-07 22:43:56 +00:00
Douglas Gregor
442612c285
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.
llvm-svn: 107827
2010-07-07 22:35:13 +00:00
Nate Begeman
5da51d38d7
Fix an issue with opencl init list checking.
...
llvm-svn: 107824
2010-07-07 22:26:56 +00:00
Zhanyong Wan
fb617d5365
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.
llvm-svn: 107816
2010-07-07 21:36:58 +00:00
Douglas Gregor
2530efd3cf
When printing statistics for the ASTContext, also print them for its BumpPtrAllocator
...
llvm-svn: 107790
2010-07-07 16:40:34 +00:00
Chris Lattner
3e2ee147d0
add driver support for minix, patch by Kees van Reeuwijk
...
from PR7583
llvm-svn: 107788
2010-07-07 16:01:42 +00:00
Argyrios Kyrtzidis
ad65c6926b
Fix broken reading of NestedNameSpecifiers from PCH.
...
llvm-svn: 107784
2010-07-07 15:46:30 +00:00
Argyrios Kyrtzidis
903ccd6121
Delay passing InterestingDecls to the Consumer until when we know we are not in recursive loading and the
...
declarations are fully initialized.
llvm-svn: 107783
2010-07-07 15:46:26 +00:00
Argyrios Kyrtzidis
54fcbc7345
getBody() -> hasBody()
...
llvm-svn: 107773
2010-07-07 12:24:18 +00:00
Argyrios Kyrtzidis
0b6a06a335
Simplify code and remove comment that is no longer relevant.
...
llvm-svn: 107772
2010-07-07 12:24:14 +00:00
Argyrios Kyrtzidis
568bc84562
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.
llvm-svn: 107771
2010-07-07 11:31:34 +00:00
Argyrios Kyrtzidis
6fbc8fa53e
Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.
...
llvm-svn: 107770
2010-07-07 11:31:27 +00:00
Argyrios Kyrtzidis
46f556d4e5
Simplify code. FunctionDecl and ObjCMethodDecl have some common interfaces.
...
llvm-svn: 107769
2010-07-07 11:31:23 +00:00
Argyrios Kyrtzidis
36ea322579
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".
llvm-svn: 107768
2010-07-07 11:31:19 +00:00
Jordy Rose
65136fb669
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.
...
llvm-svn: 107761
2010-07-07 08:15:01 +00:00
Duncan Sands
86f86f532a
A Release-Asserts build is now called a Release build.
...
llvm-svn: 107760
2010-07-07 07:49:17 +00:00
Jordy Rose
33c829a6fd
Cleanup on CStringChecker and its associated tests. Also check for null arguments...which are allowed if the access length is 0!
...
llvm-svn: 107759
2010-07-07 07:48:06 +00:00
John McCall
b609d3f5f9
Teach function-try-blocks on constructors and destructors to implicitly
...
rethrow. Fixes rdar://problem/7696603
llvm-svn: 107757
2010-07-07 06:56:46 +00:00
Chris Lattner
3956106543
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.
llvm-svn: 107756
2010-07-07 06:14:23 +00:00
John McCall
11086fcb65
Don't consider casted non-global pointers to be evaluatable.
...
Fixes rdar://problem/8154689
llvm-svn: 107755
2010-07-07 05:08:32 +00:00
Craig Silverstein
6f9236e762
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
llvm-svn: 107754
2010-07-07 04:38:11 +00:00
Tom Care
ca1f871ff8
Change explicit handling of impossible condition to call llvm_unreachable in IdempotentOperationChecker::PreVisitBinaryOperator.
...
llvm-svn: 107748
2010-07-07 01:27:17 +00:00
Chandler Carruth
509a9ce9da
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.
llvm-svn: 107745
2010-07-07 00:36:56 +00:00
Chandler Carruth
dce439d11d
Use 'llvm_unreachable' to mark impossible code paths so that GCC doesn't
...
consider them for warnings.
llvm-svn: 107741
2010-07-07 00:07:37 +00:00
John McCall
09ae03299a
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. :)
llvm-svn: 107739
2010-07-06 23:57:41 +00:00
Ted Kremenek
da534381f8
Fix casts in RegionStore to not always assume that bindings are only to SubRegions. Fixes assertion failure
...
reported in PR 7572.
llvm-svn: 107738
2010-07-06 23:53:29 +00:00
Craig Silverstein
43adffd1d4
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.
llvm-svn: 107737
2010-07-06 23:51:34 +00:00
Tom Care
49f1e908b2
Fix idempotent operations test command line arguments.
...
llvm-svn: 107735
2010-07-06 23:47:26 +00:00
Ted Kremenek
0fc6354f2f
Implement dumpToStream() for NonStaticGlobalSpaceRegion and StaticGlobalSpaceRegion.
...
llvm-svn: 107731
2010-07-06 23:37:21 +00:00
Jordy Rose
cf781e5430
Add comment noting VLASizeChecker's duty in defining a VLA's extent.
...
llvm-svn: 107728
2010-07-06 23:33:54 +00:00
Jordy Rose
134a236a14
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.
...
llvm-svn: 107722
2010-07-06 23:11:01 +00:00
Ted Kremenek
128bfb7643
Sort CMake file.
...
llvm-svn: 107709
2010-07-06 22:03:19 +00:00
Tom Care
3ff08a8e76
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
llvm-svn: 107706
2010-07-06 21:43:29 +00:00
Nick Lewycky
c96c37f6fd
Fix multiple emission of the this-> fixit for each instantiation by fixing the
...
AST during the instantiation. Fixes PR7417!
llvm-svn: 107690
2010-07-06 19:51:49 +00:00
John McCall
189223e222
Make CGBuilderTy a typedef again; its functionality has been rolled back
...
into IRBuilder.
llvm-svn: 107687
2010-07-06 18:43:48 +00:00
Douglas Gregor
ec9c6ae1cb
Improve the accuracy of getSourceRange() for DeclaratorDecl and
...
TagDecl subclasses when out-of-line template declaration information
is available, from Peter Collingbourne!
llvm-svn: 107686
2010-07-06 18:42:40 +00:00
Douglas Gregor
d890b734f8
Correctly set the location of the "template" keyword for a class
...
template specialization, from Peter Collingbourne.
llvm-svn: 107682
2010-07-06 18:33:12 +00:00
Douglas Gregor
6191f6c607
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.
llvm-svn: 107681
2010-07-06 18:29:01 +00:00
Duncan Sands
1614396b15
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.
llvm-svn: 107679
2010-07-06 18:19:40 +00:00
John McCall
2d605ac1f5
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.
llvm-svn: 107676
2010-07-06 17:35:03 +00:00
Tom Care
4626285dba
Added several helper functions to Stmt to recursively check for different elements (macros, enum constants, etc).
...
llvm-svn: 107675
2010-07-06 17:28:49 +00:00
Argyrios Kyrtzidis
39fdf81b43
Read/write function template specializations for PCH, properly this time.
...
llvm-svn: 107665
2010-07-06 15:37:09 +00:00
Argyrios Kyrtzidis
af2eac2869
Add to PCH missing Sema information about VTable uses and dynamic classes.
...
llvm-svn: 107664
2010-07-06 15:37:04 +00:00
Argyrios Kyrtzidis
181431cd91
Allow a CXXRecordDecl to get a DefinitionData pointer even when its owner is still initializing.
...
llvm-svn: 107663
2010-07-06 15:36:58 +00:00
Argyrios Kyrtzidis
282b36b7f6
Read/write instantiated-from-member of EnumDecl for PCH.
...
llvm-svn: 107662
2010-07-06 15:36:48 +00:00
Zhongxing Xu
2231a920d0
Add skeleton code to make wpa call the analysis engine.
...
llvm-svn: 107646
2010-07-06 09:18:02 +00:00
Zhongxing Xu
5b488b1e6c
Add an assertion.
...
llvm-svn: 107645
2010-07-06 07:08:47 +00:00
Zhongxing Xu
b525bce698
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.
llvm-svn: 107642
2010-07-06 05:55:13 +00:00
John McCall
466e221037
When creating functions to run global initializers and destructors, mark them
...
as nounwind in -fno-exceptions. Fixes rdar://problem/8090834.
llvm-svn: 107639
2010-07-06 04:38:10 +00:00
Jordy Rose
c7c8c3d66b
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.
...
llvm-svn: 107638
2010-07-06 04:12:24 +00:00
Jordy Rose
4c0a919732
Oops, tabs --> spaces in test.
...
llvm-svn: 107634
2010-07-06 02:42:09 +00:00
Jordy Rose
40c5c24c06
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).
...
llvm-svn: 107633
2010-07-06 02:34:42 +00:00
John McCall
2b6ac78e07
Stop testing for specific basic block numbers in this test.
...
llvm-svn: 107632
2010-07-06 02:14:28 +00:00
John McCall
bd30929e4d
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.
llvm-svn: 107631
2010-07-06 01:34:17 +00:00
Zhongxing Xu
f894cfb44f
Local variables have no linkage, make invalid Entities.
...
llvm-svn: 107630
2010-07-06 01:20:49 +00:00
Chris Lattner
ceddafb846
Generate fewer first class aggregate values for other
...
coerce cases (e.g. {double,int}) which avoids fastisel
bailing out at -O0.
llvm-svn: 107628
2010-07-05 20:41:41 +00:00
Chris Lattner
c401de9998
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
llvm-svn: 107627
2010-07-05 20:21:00 +00:00
Chris Lattner
93b2836267
fix a bug I introduced in r107624
...
llvm-svn: 107626
2010-07-05 19:36:34 +00:00
Chris Lattner
9156f1bdd3
rearrange some logic, no functionality change.
...
llvm-svn: 107624
2010-07-05 19:17:26 +00:00
Chris Lattner
53b479ff6a
fix PR7564 a cast where the bitfield struct init code
...
wasn't handling array padding elements right.
llvm-svn: 107621
2010-07-05 18:03:30 +00:00
Chris Lattner
9a3459f1a6
AppendBitField really can never fail, so return its return value.
...
Everyone knows that no bugs are ever possible with bitfields.
llvm-svn: 107620
2010-07-05 17:04:23 +00:00
Argyrios Kyrtzidis
a95d019150
Read/write the identifier namespace in PCH for decls that may modify it.
...
We can now use a PCH'ed <map>.
llvm-svn: 107617
2010-07-05 10:38:01 +00:00
Argyrios Kyrtzidis
927d8e06c1
Read/write some source location for PCH.
...
llvm-svn: 107616
2010-07-05 10:37:55 +00:00
Jordy Rose
0704a7fe43
Support sizeof for VLA expressions (sizeof(someVLA)). sizeof(int[n]) still unimplemented. A VLA region's sizeof value matches its extent.
...
llvm-svn: 107611
2010-07-05 04:42:43 +00:00
Zhongxing Xu
1bbbc2e509
Refrase comments.
...
llvm-svn: 107607
2010-07-05 02:36:16 +00:00
Zhongxing Xu
74458782cc
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.
llvm-svn: 107606
2010-07-05 02:35:40 +00:00
Zhongxing Xu
57012ee70d
Make FieldDecl an invalid Entity since it has no linkage.
...
llvm-svn: 107605
2010-07-05 02:31:16 +00:00
Zhongxing Xu
5776d439ca
Indexer: make FieldDecl an internal Entity.
...
llvm-svn: 107604
2010-07-05 01:44:14 +00:00
Jordy Rose
e6b999bf9a
Track extents for VLAs.
...
llvm-svn: 107603
2010-07-05 00:50:15 +00:00
Argyrios Kyrtzidis
b5fcdc21c2
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().
llvm-svn: 107598
2010-07-04 21:44:47 +00:00
Argyrios Kyrtzidis
6685e8a747
Read/write more information of ASTContext for PCH. Overriden methods and instantiated-from information.
...
llvm-svn: 107597
2010-07-04 21:44:35 +00:00
Argyrios Kyrtzidis
e51e554a82
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.
llvm-svn: 107596
2010-07-04 21:44:25 +00:00
Argyrios Kyrtzidis
e862cbc5f6
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.
llvm-svn: 107595
2010-07-04 21:44:19 +00:00
Argyrios Kyrtzidis
ccde6a02c8
Write/read ParmVarDecl's UninstantiatedDefaultArg for PCH.
...
llvm-svn: 107594
2010-07-04 21:44:07 +00:00
Argyrios Kyrtzidis
cdb8b3f7ec
Read/write specialization info of static data members for PCH.
...
llvm-svn: 107593
2010-07-04 21:44:00 +00:00
Nick Lewycky
0bdaf64fd7
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.
llvm-svn: 107592
2010-07-04 21:29:45 +00:00
Nick Lewycky
b0077deefa
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).
llvm-svn: 107578
2010-07-04 01:41:30 +00:00
Jordy Rose
674bd55f02
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.
llvm-svn: 107577
2010-07-04 00:00:41 +00:00
Benjamin Kramer
ba62bda998
Unbreak test on platforms where size_t != unsigned long.
...
llvm-svn: 107574
2010-07-03 20:33:13 +00:00
John McCall
1e5d75d73f
Mark the operator delete associated with a virtual destructor as referenced.
...
llvm-svn: 107573
2010-07-03 18:33:00 +00:00
Charles Davis
3babfba597
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).
llvm-svn: 107572
2010-07-03 16:56:59 +00:00
John McCall
1180f8e90f
Provide convenience routines to save and restore the current insertion
...
point.
llvm-svn: 107570
2010-07-03 09:25:20 +00:00
Charles Davis
3b10dd1bec
Fix mangling of array dimensions in the Microsoft C++ Mangler.
...
llvm-svn: 107568
2010-07-03 08:15:16 +00:00
Charles Davis
d49950a317
Mangle member pointer types in the Microsoft C++ Mangler.
...
llvm-svn: 107567
2010-07-03 08:01:32 +00:00
Argyrios Kyrtzidis
dae2a1607e
When setting the anonymous namespace at PCH reading, it may still be initializing so avoid
...
the invariant checks at NamespaceDecl::setAnonymousNamespace().
llvm-svn: 107566
2010-07-03 07:57:53 +00:00
Charles Davis
0029a2a957
Fix mangling of function pointers in the Microsoft C++ Mangler.
...
llvm-svn: 107564
2010-07-03 05:53:41 +00:00
Shantonu Sen
df44f74290
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
llvm-svn: 107562
2010-07-03 03:08:23 +00:00
Charles Davis
77552766d9
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.
llvm-svn: 107561
2010-07-03 02:41:45 +00:00
Douglas Gregor
9672f92f7f
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>.
llvm-svn: 107551
2010-07-03 00:47:00 +00:00
Douglas Gregor
a6d695057c
Lazily declare implicit copy constructors.
...
llvm-svn: 107543
2010-07-02 23:41:54 +00:00
Argyrios Kyrtzidis
3701fcd759
Read/write CastExpr's CXXBaseSpecifierArray for PCH.
...
llvm-svn: 107542
2010-07-02 23:30:27 +00:00
Argyrios Kyrtzidis
4259ebcdac
Fix broken PCH support for CXXDefaultArgExpr.
...
llvm-svn: 107541
2010-07-02 23:30:15 +00:00
Douglas Gregor
52b7282081
Introduce a new routine, LookupConstructors(), and use it for all
...
constructor-name lookup.
llvm-svn: 107536
2010-07-02 23:12:18 +00:00
Douglas Gregor
330b9cff74
Lazily declare copy-assignment operators.
...
llvm-svn: 107521
2010-07-02 21:50:04 +00:00
Zhanyong Wan
5bf71a3af5
Make RecursiveASTVisitor traverse function parameter types in a function
...
prototype declaration. Reviewed by chandlerc and csilvers.
llvm-svn: 107511
2010-07-02 21:02:30 +00:00
Douglas Gregor
7454c563f1
Lazily declare the implicitly-declared destructor in a C++ class.
...
llvm-svn: 107510
2010-07-02 20:37:36 +00:00
Craig Silverstein
27e11400ad
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.
llvm-svn: 107497
2010-07-02 19:07:50 +00:00
Douglas Gregor
0be31a2eb7
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.
llvm-svn: 107491
2010-07-02 17:43:08 +00:00
Douglas Gregor
05dac7d154
By default, warn about commas at the end of an enumerator list in C++/C89.
...
llvm-svn: 107485
2010-07-02 16:17:01 +00:00
Argyrios Kyrtzidis
335751610e
Handle CXXConstructorDecl, CXXDestructorDecl, and CXXConversionDecl for PCH.
...
<vector> header can be used correctly through PCH now.
llvm-svn: 107483
2010-07-02 15:58:43 +00:00
Argyrios Kyrtzidis
746c889e34
Provide some test cases for C++ PCH.
...
llvm-svn: 107479
2010-07-02 11:55:48 +00:00
Argyrios Kyrtzidis
a45855fc2a
Disable Decl::CheckAccessDeclContext() temporarily.
...
llvm-svn: 107478
2010-07-02 11:55:44 +00:00
Argyrios Kyrtzidis
373a83abdc
Fix reading FunctionDecls from PCH.
...
llvm-svn: 107477
2010-07-02 11:55:40 +00:00
Argyrios Kyrtzidis
e23371e71d
Fix reading ClassTemplateDecl's ClassTemplateSpecializationDecls and ClassTemplatePartialSpecializationDecls.
...
Store/read also their template arguments because they may be initializing and not be able to provide them.
llvm-svn: 107476
2010-07-02 11:55:37 +00:00
Argyrios Kyrtzidis
2c2167ac3d
Fully read/write CXXRecordDecl for PCH.
...
llvm-svn: 107475
2010-07-02 11:55:32 +00:00
Argyrios Kyrtzidis
e929095f4a
Fix reading of DependentNameType.
...
llvm-svn: 107474
2010-07-02 11:55:24 +00:00
Argyrios Kyrtzidis
dab33c5d33
Allow reading of InjectedClassNameType from PCH even when its decl is currently initializing.
...
llvm-svn: 107473
2010-07-02 11:55:20 +00:00
Argyrios Kyrtzidis
ee776bcb7a
Fix broken reading of member pointer from PCH.
...
llvm-svn: 107472
2010-07-02 11:55:15 +00:00
Argyrios Kyrtzidis
45a83f9acc
- Allow a typedef type to be read from PCH even if its decl is currently initializing.
...
- Fix creation of TemplateSpecializationType.
llvm-svn: 107471
2010-07-02 11:55:11 +00:00
Argyrios Kyrtzidis
e3029a7e7b
Fix broken reading of "#lines" from PCH.
...
llvm-svn: 107470
2010-07-02 11:55:05 +00:00
Argyrios Kyrtzidis
318b0e78c6
Generally types expect an initialized TypeDecl; its safer and less complicated to delay PCH reading the type of a TypeDecl.
...
llvm-svn: 107469
2010-07-02 11:55:01 +00:00
Argyrios Kyrtzidis
39f0e308c4
Add some side-effect free Create methods for TypeDecl subclasses and use them for PCH reading.
...
llvm-svn: 107468
2010-07-02 11:54:55 +00:00
Zhongxing Xu
d6c221c3ee
Create a ASTUnitTU class to interface ASTUnit to the Indexer.
...
llvm-svn: 107467
2010-07-02 11:52:15 +00:00
Zhongxing Xu
a94ec74c6f
add -analyze-function option.
...
llvm-svn: 107463
2010-07-02 07:03:03 +00:00
Zhongxing Xu
7842c0836d
add -view-call-graph option to wpa.
...
llvm-svn: 107462
2010-07-02 06:58:30 +00:00
Zhongxing Xu
a74c22daec
Change CallGraph::Prog to be a reference. idx::Program means to be a global object to the Index library.
...
llvm-svn: 107461
2010-07-02 06:39:46 +00:00
Craig Silverstein
19ebcd0f28
Handle typedef function declarations correctly, such as
...
typedef int (*Myfunc)(int);
Myfunc func;
Reviewed by chandlerc
llvm-svn: 107450
2010-07-01 23:46:26 +00:00
Douglas Gregor
e71eddac59
Add a new routine Sema::LookupDestructor and make all destructor-lookup calls use that routine
...
llvm-svn: 107444
2010-07-01 22:47:18 +00:00
Douglas Gregor
6d880b1a83
Provide exception specifications for implicitly-declared default constructors.
...
llvm-svn: 107437
2010-07-01 22:31:05 +00:00
Douglas Gregor
4e8b5fb1eb
Move the implicit declaration of a default constructor into a separate
...
routine; no functionality change.
llvm-svn: 107434
2010-07-01 22:02:46 +00:00
Douglas Gregor
8453ddb5fe
Provide exception specifications for implicitly-declared copy constructors.
...
llvm-svn: 107429
2010-07-01 20:59:04 +00:00
Daniel Dunbar
a2b1f8b5cd
MC: Pass the target instance to the AsmParser constructor.
...
llvm-svn: 107427
2010-07-01 20:41:59 +00:00
Ted Kremenek
bd862711fd
Fix PR 7475 by enhancing the static analyzer to also invalidate bindings for non-static global variables
...
when calling a function/method whose impact on global variables we cannot accurately estimate.
This change introduces two new MemSpaceRegions that divide up the memory space of globals, and causes
RegionStore and BasicStore to consult a binding to the NonStaticGlobalsMemSpaceRegion when lazily
determining the value of a global.
llvm-svn: 107423
2010-07-01 20:16:50 +00:00
Jordy Rose
f7488ec6dc
Add an ivar to SymbolReaper for the current statement, and then stop passing the current statement around everywhere. Preparation for symbolic extents.
...
llvm-svn: 107422
2010-07-01 20:09:55 +00:00
Douglas Gregor
19ecba740f
Test implicit declaration of copy assignment operator with non-const argument
...
llvm-svn: 107421
2010-07-01 20:08:52 +00:00
Douglas Gregor
f120304cc4
Move the implicit declaration of a constructor out to a separate
...
method. No functionality change.
llvm-svn: 107415
2010-07-01 19:09:28 +00:00
Douglas Gregor
cfe682274c
Teach DeclareImplicitCopyConstructor how to cope with virtual bases
...
and multi-dimensional array fields. Fixes several bugs found by
inspection.
llvm-svn: 107411
2010-07-01 18:27:03 +00:00
Douglas Gregor
54be33925a
Move declaration of a class's implicit copy constructor into a
...
separate function. Aside from making the loops infinitely faster, no
functionality change.
llvm-svn: 107407
2010-07-01 17:57:27 +00:00
Douglas Gregor
68e1136585
Provide an exception-specification for an implicitly-declared
...
copy-assignment operator.
llvm-svn: 107406
2010-07-01 17:48:08 +00:00
Douglas Gregor
f56ab7b6be
Move the implicit declaration of a class's copy-assignment operator
...
into a separate routine. No functionality change.
llvm-svn: 107402
2010-07-01 16:36:15 +00:00
Douglas Gregor
3311ed4f0e
Make loops infinitely faster. No functionality change.
...
llvm-svn: 107398
2010-07-01 15:29:53 +00:00
Douglas Gregor
2f3d9e8264
Add Sema test case for exception-specifiers implicitly added to destructors.
...
llvm-svn: 107395
2010-07-01 14:21:35 +00:00
Douglas Gregor
bac7490ffc
Remove unnecessary ASTContext parameter from
...
CXXRecordDecl::getDestructor(); no functionality change.
llvm-svn: 107394
2010-07-01 14:13:13 +00:00
Zhongxing Xu
bf81ed1fcf
ExplodedGraph never uses ASTContext, remove it.
...
llvm-svn: 107388
2010-07-01 07:10:59 +00:00
Chris Lattner
0e7929f30c
fix rdar://8147692 - yet another crash due to my abi work.
...
llvm-svn: 107387
2010-07-01 06:20:47 +00:00
Douglas Gregor
957551609c
Reinstate fix for PR7526, which was failing because, now that we
...
aren't dropping all exception specifications on destructors, the
exception specifications on implicitly-declared destructors were
detected as being wrong (which they were).
Introduce logic to provide a proper exception-specification for
implicitly-declared destructors. This also fixes PR6972.
Note that the other implicitly-declared special member functions also
need to get exception-specifications. I'll deal with that in a
subsequent commit.
llvm-svn: 107385
2010-07-01 05:10:53 +00:00
Douglas Gregor
d537dc022a
Update diagnostic on compatibility page to reflect reality
...
llvm-svn: 107382
2010-07-01 03:50:01 +00:00
Douglas Gregor
7c42659cee
When performing copy initialization via user-defined conversions,
...
don't allow two user-defined conversions. Fixes PR6595 (again).
llvm-svn: 107379
2010-07-01 03:43:00 +00:00
Douglas Gregor
3671ad4571
Revert r107374, which broke bootstrap.
...
llvm-svn: 107378
2010-07-01 03:28:42 +00:00
Douglas Gregor
c6e4c68371
When building the type of a destructor, make sure to keep the
...
exception specification. Fixes PR7526.
llvm-svn: 107374
2010-07-01 02:33:15 +00:00
Douglas Gregor
fb0c0d37b7
Extend the "cannot convert from base class pointer to derived class
...
pointer" diagnostic to handle references, too.
llvm-svn: 107372
2010-07-01 02:14:45 +00:00
Daniel Dunbar
223749db6c
Driver: .dSYM suffix should be appended, not replace the existing suffix.
...
llvm-svn: 107369
2010-07-01 01:36:31 +00:00
Daniel Dunbar
bb7ac52e02
Driver/IRgen: Add support for -momit-leaf-frame-pointer.
...
llvm-svn: 107367
2010-07-01 01:31:45 +00:00
Ted Kremenek
78f8c3014d
Update checker build.
...
llvm-svn: 107364
2010-07-01 01:06:36 +00:00
Douglas Gregor
a343430e00
Add test case that I forgot to commit with r107354 (the implementation
...
of C++ DR481).
llvm-svn: 107359
2010-07-01 00:21:50 +00:00
Douglas Gregor
5a5fcd83c5
Be a bit more careful with undefined CXXRecordDecls. Fixes
...
rdar://problem/8124080 and PR7118.
llvm-svn: 107358
2010-07-01 00:21:21 +00:00
Daniel Dunbar
3de064dfdf
Revert "IRgen: Make sure any prolog instructions get debug info.", the lexical
...
scope hasn't been set up yet so this isn't valid. It was just a cleanup to the
IR, so I'm going to ignore it for now.
llvm-svn: 107356
2010-07-01 00:16:31 +00:00
Douglas Gregor
dc13ded606
Implement C++ DR481, which clarifies that the scope of template
...
parameters starts at the end of the template-parameter rather than at
the point where the template parameter name is encounted. For example,
given:
typedef unsigned char T;
template<typename T = T> struct X0 { };
The "T" in the default argument refers to the typedef of "unsigned
char", rather than referring to the newly-introduced template type
parameter 'T'.
Addresses <rdar://problem/8122812>.
llvm-svn: 107354
2010-07-01 00:00:45 +00:00
Daniel Dunbar
9dcde4bdec
Driver/Darwin: Add one -L for the DarwinClang toolchain to point into the gcc
...
library directory, as we still rely on a few libraries that are hiding there (in
particular libstdc++.dylib).
llvm-svn: 107353
2010-06-30 23:56:13 +00:00
Douglas Gregor
56f2e34a6a
Improve diagnostic when we fail to pick an overload because it would
...
require a base-to-derived pointer conversion.
llvm-svn: 107349
2010-06-30 23:01:39 +00:00
John Thompson
781ad17ba9
Fix vector literal/cast confusion - bug 6895.
...
llvm-svn: 107347
2010-06-30 22:55:51 +00:00
Douglas Gregor
5396853d81
Wording tweak from Dan.
...
llvm-svn: 107344
2010-06-30 22:43:03 +00:00
Douglas Gregor
426c572d78
Wording tweak from Dan.
...
llvm-svn: 107343
2010-06-30 22:38:37 +00:00
Benjamin Kramer
aab931dd32
typo.
...
llvm-svn: 107342
2010-06-30 22:29:56 +00:00
Daniel Dunbar
4a58ced750
Runtime: Always build compiler-rt using the Clang we just built, instead of the
...
system CC.
llvm-svn: 107328
2010-06-30 22:10:41 +00:00
Daniel Dunbar
8d65fc86c4
Move lib/Runtime to runtime/, and build after everything else.
...
llvm-svn: 107327
2010-06-30 22:10:38 +00:00
Douglas Gregor
b7b04ae204
Remove redundant and incomplete bits from the users manual w.r.t. language conformance
...
llvm-svn: 107326
2010-06-30 22:04:24 +00:00
Douglas Gregor
9c9f26d4bf
New language-compatibility page, including language-compatibility information for the various language dialects Clang supports in a single, easy-to-find page
...
llvm-svn: 107325
2010-06-30 22:01:08 +00:00
Daniel Dunbar
df000da850
libclang: When invoking external clang process to get code completion results,
...
pass -ccc-clang-cxx to force C++ support (even if the binary was built without
it).
llvm-svn: 107324
2010-06-30 21:40:01 +00:00
Daniel Dunbar
6696e22cc9
IRgen: Fix debug info regression in r106970; when we eliminate the return value
...
store make sure to move the debug metadata from the store (which is actual
'return' statement location) to the return instruction (which otherwise would
have the function end location as its debug info).
- Tested by gdb test suite.
llvm-svn: 107322
2010-06-30 21:27:58 +00:00
Daniel Dunbar
d7ac9a375a
IRgen: Make sure any prolog instructions get debug info.
...
llvm-svn: 107320
2010-06-30 21:27:56 +00:00
Daniel Dunbar
8ab6c54ce2
Rewriter: Use the appropriate printing context instead of the default
...
constructed one -- this is necessary to ensure types get printed correctly.
llvm-svn: 107312
2010-06-30 19:16:53 +00:00
Daniel Dunbar
219fa69f91
AST: Propogate printing policy to types in a bunch more places.
...
llvm-svn: 107311
2010-06-30 19:16:48 +00:00
Chris Lattner
5c740f1523
Reapply:
...
r107173, "fix PR7519: after thrashing around and remembering how all this stuff"
r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead"
This includes a fix to make ConvertTypeForMem handle the "recursive" case, and call
it as such when lowering function types which have an indirect result.
llvm-svn: 107310
2010-06-30 19:14:05 +00:00
Fariborz Jahanian
02995320e9
Use isFunctionOrMethod for vars declared locallly
...
in method/blocks to decide not to mangle them.
llvm-svn: 107309
2010-06-30 18:57:21 +00:00
Eric Christopher
aba9fb217e
Add a return to silence a warning. Alternately a default: return false
...
would work.
Sebastian: figure out which one you want :)
llvm-svn: 107305
2010-06-30 18:36:32 +00:00
Zhanyong Wan
88d5a91f0d
Fix RecursiveASTVisitor to traverse the ctor initializer list before
...
traversing the ctor body when traversing a CXXConstructorDecl.
Reviewed by chandlerc and csilvers.
llvm-svn: 107304
2010-06-30 18:34:52 +00:00
Fariborz Jahanian
0f19afb9d4
extern variable declared locally to objective-c++ method
...
should not be mangled either. Fixes radar 8016412.
llvm-svn: 107303
2010-06-30 18:27:47 +00:00
Sebastian Redl
d92badfd9c
Make both old and new versions of reference binding use the new classification functions, and updated them for N3092.
...
llvm-svn: 107301
2010-06-30 18:13:39 +00:00
Douglas Gregor
bc0c79b4ab
Clean up the diagnostic complaining about the element type of a vector
...
type so that it actually complains about the element type itself.
llvm-svn: 107299
2010-06-30 17:30:41 +00:00
Douglas Gregor
2187266120
Complain about the application of a transparent_union attribute to a
...
union whose first field has integral vector type. Also, clean up this
diagnostic a bit. Thanks to Eli for spotting this change in semantics
last week.
llvm-svn: 107296
2010-06-30 17:24:13 +00:00
Chris Lattner
749b8ed5af
reduce nesting.
...
llvm-svn: 107292
2010-06-30 16:58:07 +00:00
Duncan Sands
36d97d8938
Add header file needed to compile with g++-4.6, which has undergone some more
...
header trimming (needed for std::uninitialized_copy).
llvm-svn: 107291
2010-06-30 16:54:05 +00:00
Sebastian Redl
d559a545d4
Fix a comment typo.
...
llvm-svn: 107290
2010-06-30 16:41:54 +00:00
Fariborz Jahanian
e33c116bdf
Nasty rewriter bug which turns out to have an easy fix in
...
rewriting a c-style cast expression in statement printer.
Fixes radar 8143056.
llvm-svn: 107289
2010-06-30 16:31:08 +00:00
Argyrios Kyrtzidis
639ffb0c07
Fix rdar://8139785 "implement warning on dead expression in comma operator"
...
As a bonus, fix the warning for || and && operators; it was emitted even if one of the operands had side effects, e.g:
x || test_logical_foo1();
emitted a bogus "expression result unused" for 'x'.
llvm-svn: 107274
2010-06-30 10:53:14 +00:00
Argyrios Kyrtzidis
bd8ac8cf07
Fix PCH support for UnresolvedUsingTypenameDecl and UnresolvedUsingValueDecl.
...
llvm-svn: 107268
2010-06-30 08:49:30 +00:00
Argyrios Kyrtzidis
4a57bd0d62
Support DependentSizedArrayType for PCH.
...
llvm-svn: 107267
2010-06-30 08:49:25 +00:00
Argyrios Kyrtzidis
f9f47c8e54
Support ParenListExpr for PCH.
...
llvm-svn: 107266
2010-06-30 08:49:18 +00:00
Argyrios Kyrtzidis
2b3ac09200
Make the constructor explicit.
...
llvm-svn: 107265
2010-06-30 08:49:12 +00:00
Charles Davis
2a47730767
Mangle arrays in the Microsoft C++ Mangler. It's not quite finished (it
...
doesn't mangle array parameters right), but I think that should be fixed
in Sema (Doug, John, what do you think?).
Also, stub out the remaining mangleType() routines.
llvm-svn: 107264
2010-06-30 08:09:57 +00:00
Ted Kremenek
169e43c4cf
Correctly implement the CheckerVisit optimization introduced in r106884, but this time actually used the cached checker list when calling back to Checker visit methods. This reduces the analysis time for sqlite3.c by 8%.
...
llvm-svn: 107259
2010-06-30 07:28:52 +00:00
Daniel Dunbar
120a1e9d0f
Headers: Define __INT64_TYPE__ in terms of getInt64Type(), which isn't always
...
'long'. The practical upshot is so that the uint64_t we define in our stdint.h
ends up being compatible with that defined by gcc (at least on Darwin), which
otherwise could lead to type incompatibilities with other system headers.
llvm-svn: 107255
2010-06-30 06:30:56 +00:00
Daniel Dunbar
540e8b1dcd
Headers: Change [u]intmax_t to be defined in terms of __[U]INTMAX_TYPE__, instead of intN_t.
...
llvm-svn: 107254
2010-06-30 06:30:50 +00:00
Chandler Carruth
139e96216a
Reapply r107235, this time with both my typo fixed, and a logical bug fixed.
...
Previously we relied on the presence of a member which needs no initialization
to prevent us from creating an additional initialization of the outer anonymous
union field. We have already correctly marked that field as initialized by the
member of the union (repeatedly due to the original bug this patch fixes) so we
simply need to bail out.
llvm-svn: 107242
2010-06-30 02:59:29 +00:00
Chandler Carruth
0e783c2e86
Revert r107235, it had a silly typo in it, and fixing the typo breaks something
...
else. Get the build bots happy while I debug. Very sorry for the delay fixing
this...
llvm-svn: 107239
2010-06-30 02:06:16 +00:00
Jordy Rose
dc48471861
Pointers casted as integers still count as locations to SimpleSValuator, so don't crash if we do a funny thing like ((int)ptr)&1. Fixes PR7527.
...
llvm-svn: 107236
2010-06-30 01:35:20 +00:00
Chandler Carruth
abb04f730e
Fix PR7402: We were creating implicit member initializers for every field in an
...
anonymous union under the presumption that they didn't do anything. While this
is true, our checks for redundant initialization of an anonymous union still
fire when these overlap with explicit user initialization. A cleaner approach
is to avoid initializing multiple members of a union altogether, but this still
is in a rather fuzzy are especially when C++0x allows non-POD types into
unions.
llvm-svn: 107235
2010-06-30 00:54:29 +00:00
Daniel Dunbar
e422266926
Revert r107173, "fix PR7519: after thrashing around and remembering how all this stuff", it broke bootstrap.
...
llvm-svn: 107232
2010-06-30 00:22:35 +00:00
Daniel Dunbar
8386469d7d
Revert r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead", it is part of a boostrap breaking sequence.
...
llvm-svn: 107231
2010-06-30 00:22:30 +00:00
Douglas Gregor
4799d03ce8
Implement C++ DR299, which allows an implicit conversion from a class
...
type to an integral or enumeration type in the size of an array new
expression, e.g.,
new int[ConvertibleToInt(10)];
This is a GNU and C++0x extension.
llvm-svn: 107229
2010-06-30 00:20:43 +00:00
Chandler Carruth
9c9286b531
Retain the source location of the constructor when building an implicit member
...
initialization. I tried several ideas but couldn't come up with a test case for
this that didn't rely on a Clang bug to report a diagnostic after template
instantiation of the constructor due to the implicit initializers. Suggestions
welcome. This fixes the source location aspect of PR7402.
llvm-svn: 107226
2010-06-29 23:50:44 +00:00
Douglas Gregor
5823da3ab0
Re-improve recovery when the condition of a switch statement does not
...
have integral or enumeration type, so that we still check the contents
of the switch body. My previous patch made this worse; now we're back
to where we were previously.
llvm-svn: 107223
2010-06-29 23:25:20 +00:00
Douglas Gregor
f4ea725d38
Factor the conversion from a switch condition to an integral or
...
enumeration type out into a separate, reusable routine. The only
functionality change here is that we recover a little more
aggressively from ill-formed switch conditions.
llvm-svn: 107222
2010-06-29 23:17:37 +00:00
Argyrios Kyrtzidis
74d28bd084
Support C++ friend declarations for PCH.
...
This commit 'introduces' a slightly different way to restore the state of the AST object.
It makes PCHDeclReader/PCHDeclWriter friends and gives them access to the private members of the object.
The rationale is to avoid using/modifying the AST interfaces for PCH read/write so that to:
-Avoid complications with objects that have side-effects during creation or when using some setters.
-Not 'pollute' the AST interface with methods only used by the PCH reader/writer
-Allow AST objects to be read-only.
llvm-svn: 107219
2010-06-29 22:47:00 +00:00
Argyrios Kyrtzidis
26d7201d5d
When we know that we are at sub-statement reading (which is all of PCHStmtReader) use the "faster" ReadSubStmt. No functionality change.
...
llvm-svn: 107218
2010-06-29 22:46:25 +00:00
Daniel Dunbar
8c94ffe776
IRgen: Assignment to Objective-C properties shouldn't reload the value, for
...
complex values either. Previously we did this properly for regular assignment,
but not for compound assignment.
- Also, tidy up assignment code a bit to look more like the scalar path.
llvm-svn: 107217
2010-06-29 22:44:21 +00:00
Chris Lattner
466b1419c6
fix PR7523, which was caused by the ABI code calling ConvertType instead
...
of ConvertTypeRecursive when it needed to in a few cases, causing pointer
types to get resolved at the wrong time.
llvm-svn: 107216
2010-06-29 22:39:04 +00:00
Daniel Dunbar
c85ea8e175
IRgen: Assignment to Objective-C properties shouldn't reload the value (which
...
would trigger an extra method call).
- While in the area, I also changed Clang to not emit an unnecessary load from
'x' in cases like 'y = (x = 1)'.
llvm-svn: 107210
2010-06-29 22:00:45 +00:00
Ted Kremenek
090d62e7cc
Tweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' also
...
be true if some paths were aborted because they exceeded
the maximum loop unrolling count.
llvm-svn: 107209
2010-06-29 21:58:54 +00:00
Ted Kremenek
3f1240b614
Add test case for <rdar://problem/4289832>. Clang actuallys gets
...
the test case right (for the noreturn warning) because the CFG
doesn't support @try yet, but the test case is now present when
we do properly implement CFG support for @try...@catch.
llvm-svn: 107203
2010-06-29 20:25:42 +00:00
Douglas Gregor
c048c52734
When typo correction produces a result that is not of the kind we're
...
looking for, reset the name within the LookupResult structure in
addition to clearing out the results. Fixes PR7508.
llvm-svn: 107197
2010-06-29 19:27:42 +00:00
Chris Lattner
cccaad9584
change ABIArgInfo to hold its llvm type with PATypeHolder so that
...
it doesn't dangle as types get refined. This fixes Shootout-C++/lists1
and probably also PR7522.
llvm-svn: 107196
2010-06-29 19:21:36 +00:00
Douglas Gregor
6969fb73ca
Fix broken testcase
...
llvm-svn: 107194
2010-06-29 19:17:14 +00:00
Douglas Gregor
9629e9ac3e
Typo correction for namespace alias definitions
...
llvm-svn: 107191
2010-06-29 18:55:19 +00:00
Daniel Dunbar
99e13101b2
tests: Fix test to not depend on instruction names.
...
llvm-svn: 107186
2010-06-29 18:34:40 +00:00
Daniel Dunbar
f35e76552f
Sema: Fix a subtle i64 -> i32 truncation which broke layout of large structures
...
with bit-fields.
llvm-svn: 107185
2010-06-29 18:34:35 +00:00
Chris Lattner
34d6281ae5
relax the CGFunctionInfo::CGFunctionInfo ctor to allow any sequence
...
of CanQualTypes to be passed in.
llvm-svn: 107176
2010-06-29 18:13:52 +00:00
Fariborz Jahanian
66f9a6560e
This patch fixes a bug whereby, clang skipped
...
unimplemented property warning for properties
coming from class's conformin protocol. It also
simplifies the algorithm in the process.
Fixes radar 8035776.
llvm-svn: 107174
2010-06-29 18:12:32 +00:00
Chris Lattner
ab1e65e2ea
fix PR7519: after thrashing around and remembering how all this stuff
...
works, the fix is quite simple: just make sure to call ConvertTypeRecursive
when the function type being lowered is in the midst of ConvertType.
llvm-svn: 107173
2010-06-29 17:56:33 +00:00
Douglas Gregor
cdf87024ed
Allow a using directive to refer to the implicitly-defined namespace
...
"std", with a warning, to improve GCC compatibility. Fixes PR7517.
As a drive-by, add typo correction for using directives.
llvm-svn: 107172
2010-06-29 17:53:46 +00:00
Douglas Gregor
56980d688b
With packed enums, an enumerator's value may be stored in more bits
...
than the enumeration type itself takes. Fixes PR7477.
llvm-svn: 107163
2010-06-29 17:12:35 +00:00
Daniel Dunbar
8452ef0798
tests: Use %clangxx when using driver for C++, in case C++ support is disabled.
...
llvm-svn: 107153
2010-06-29 16:52:24 +00:00
Daniel Dunbar
ec1bee907a
tests: Spell %clang_cc1 correctly.
...
llvm-svn: 107152
2010-06-29 16:52:18 +00:00
Chris Lattner
e70a007b36
minor cleanups.
...
llvm-svn: 107150
2010-06-29 16:40:28 +00:00
Daniel Dunbar
00d3d8e902
Driver/Darwin: Only run dsymutil when we are also compiling/assembling as part
...
of the compilation.
- <rdar://problem/8141387> clang is always invoking dsymutil
llvm-svn: 107149
2010-06-29 16:38:33 +00:00
Jeffrey Yasskin
bb219e01a6
Delete assert in ComputeKeyFunction. The function runs fine without it, since
...
there's an explicit guard on isPolymorphic, and virtual bases don't affect the
key function calculation. This allows people to call
ASTContext::getKeyFunction on arbitrary classes.
llvm-svn: 107143
2010-06-29 15:27:35 +00:00
Chris Lattner
22a931e3bb
Change X86_64ABIInfo to have ASTContext and TargetData ivars to
...
avoid passing ASTContext down through all the methods it has.
When classifying an argument, or argument piece, as INTEGER, check
to see if we have a pointer at exactly the same offset in the
preferred type. If so, use that pointer type instead of i64. This
allows us to compile A function taking a stringref into something
like this:
define i8* @foo(i64 %D.coerce0, i8* %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%0 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %D.coerce0, i64* %0
%1 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
store i8* %D.coerce1, i8** %1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
instead of this:
define i8* @foo(i64 %D.coerce0, i64 %D.coerce1) nounwind ssp {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%0 = insertvalue %0 undef, i64 %D.coerce0, 0 ; <%0> [#uses=1]
%1 = insertvalue %0 %0, i64 %D.coerce1, 1 ; <%0> [#uses=1]
%2 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %1, %0* %2, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
This implements rdar://7375902 - [codegen quality] clang x86-64 ABI lowering code punishing StringRef
llvm-svn: 107123
2010-06-29 06:01:59 +00:00
Chris Lattner
de310d5d95
Minix doesn't support dylibs, PR7294
...
llvm-svn: 107120
2010-06-29 05:05:09 +00:00
Chris Lattner
399d22ac1b
plumb preferred types down into X86_64ABIInfo::classifyArgumentType,
...
no functionality change.
llvm-svn: 107115
2010-06-29 01:14:09 +00:00
Chris Lattner
1d7c9f7f4b
Pass the LLVM IR version of argument types down into computeInfo.
...
This is somewhat annoying to do this at this level, but it avoids
having ABIInfo know depend on CodeGenTypes for a hint.
Nothing is using this yet, so no functionality change.
llvm-svn: 107111
2010-06-29 01:08:48 +00:00
Chandler Carruth
8337ba6303
Prefer llvm_unreachable(...) to assert(false && ...). This is important as
...
without it we might exit a non-void function without returning.
llvm-svn: 107106
2010-06-29 00:23:11 +00:00
Chris Lattner
9e748e9d6e
add IR names to coerced arguments.
...
llvm-svn: 107105
2010-06-29 00:14:52 +00:00
Chris Lattner
15ec361bd6
make the argument passing stuff in the FCA case smarter still, by
...
avoiding making the FCA at all when the types exactly line up. For
example, before we made:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %struct.DeclGroup undef, i64 %0, 0 ; <%struct.DeclGroup> [#uses=1]
%3 = insertvalue %struct.DeclGroup %2, i64 %1, 1 ; <%struct.DeclGroup> [#uses=1]
store %struct.DeclGroup %3, %struct.DeclGroup* %D
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
... which has the pointless insertvalue, which fastisel hates, now we
make:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=4]
%2 = getelementptr %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
store i64 %0, i64* %2
%3 = getelementptr %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 %1, i64* %3
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
This only kicks in when x86-64 abi lowering decides it likes us.
llvm-svn: 107104
2010-06-29 00:06:42 +00:00
Craig Silverstein
1b28a4298e
A few prettifications. Also renamed TraverseInitializer to
...
TraverseConstructorInitializer, to be a bit clearer.
llvm-svn: 107102
2010-06-29 00:02:17 +00:00
Ted Kremenek
5414027020
Per Doug's suggestion, move check for invalid SourceLocation into
...
cxloc::translateSourceLocation() (thus causing all clients of this
function to have the same behavior).
llvm-svn: 107101
2010-06-28 23:54:17 +00:00
Chris Lattner
3dd716c3c3
Change CGCall to handle the "coerce" case where the coerce-to type
...
is a FCA to pass each of the elements as individual scalars. This
produces code fast isel is less likely to reject and is easier on
the optimizers.
For example, before we would compile:
struct DeclGroup { long NumDecls; char * Y; };
char * foo(DeclGroup D) {
return D.NumDecls+D.Y;
}
to:
%struct.DeclGroup = type { i64, i64 }
define i64 @_Z3foo9DeclGroup(%struct.DeclGroup) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
store %struct.DeclGroup %0, %struct.DeclGroup* %D, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i64*> [#uses=1]
%tmp3 = load i64* %tmp2 ; <i64> [#uses=1]
%add = add nsw i64 %tmp1, %tmp3 ; <i64> [#uses=1]
ret i64 %add
}
Now we get:
%0 = type { i64, i64 }
%struct.DeclGroup = type { i64, i8* }
define i8* @_Z3foo9DeclGroup(i64, i64) nounwind {
entry:
%D = alloca %struct.DeclGroup, align 8 ; <%struct.DeclGroup*> [#uses=3]
%2 = insertvalue %0 undef, i64 %0, 0 ; <%0> [#uses=1]
%3 = insertvalue %0 %2, i64 %1, 1 ; <%0> [#uses=1]
%4 = bitcast %struct.DeclGroup* %D to %0* ; <%0*> [#uses=1]
store %0 %3, %0* %4, align 1
%tmp = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 0 ; <i64*> [#uses=1]
%tmp1 = load i64* %tmp ; <i64> [#uses=1]
%tmp2 = getelementptr inbounds %struct.DeclGroup* %D, i32 0, i32 1 ; <i8**> [#uses=1]
%tmp3 = load i8** %tmp2 ; <i8*> [#uses=1]
%add.ptr = getelementptr inbounds i8* %tmp3, i64 %tmp1 ; <i8*> [#uses=1]
ret i8* %add.ptr
}
Elimination of the FCA inside the function is still-to-come.
llvm-svn: 107099
2010-06-28 23:44:11 +00:00