Граф коммитов

22706 Коммитов

Автор SHA1 Сообщение Дата
Tom Care db2fa8a7eb 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
2010-07-06 21:43:29 +00:00
Nick Lewycky 03d98c5d59 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
2010-07-06 19:51:49 +00:00
John McCall df921aef35 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
2010-07-06 18:43:48 +00:00
Douglas Gregor 1693e154be 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
2010-07-06 18:42:40 +00:00
Douglas Gregor 7e9b57b9db 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
2010-07-06 18:33:12 +00:00
Douglas Gregor af57280ff8 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
2010-07-06 18:29:01 +00:00
Duncan Sands 1f377b1783 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
2010-07-06 18:19:40 +00:00
John McCall 66d80a9c99 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
2010-07-06 17:35:03 +00:00
Tom Care 7d6228fc77 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
2010-07-06 17:28:49 +00:00
Argyrios Kyrtzidis 057d9afdc7 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
2010-07-06 15:37:09 +00:00
Argyrios Kyrtzidis d455add086 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
2010-07-06 15:37:04 +00:00
Argyrios Kyrtzidis 0f47bb98cb 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
2010-07-06 15:36:58 +00:00
Argyrios Kyrtzidis 74228274ba 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
2010-07-06 15:36:48 +00:00
Zhongxing Xu 65d336b6b9 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
2010-07-06 09:18:02 +00:00
Zhongxing Xu e4f5d72a50 Add an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107645 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 07:08:47 +00:00
Zhongxing Xu dc01a153f2 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
2010-07-06 05:55:13 +00:00
John McCall 044cc54a7d 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
2010-07-06 04:38:10 +00:00
Jordy Rose 5dd3af78a1 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
2010-07-06 04:12:24 +00:00
Jordy Rose b829d72294 Oops, tabs --> spaces in test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107634 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-06 02:42:09 +00:00
Jordy Rose 61fb55c879 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
2010-07-06 02:34:42 +00:00
John McCall 252cd6a762 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
2010-07-06 02:14:28 +00:00
John McCall f1549f66a8 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
2010-07-06 01:34:17 +00:00
Zhongxing Xu 6c47a9b977 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
2010-07-06 01:20:49 +00:00
Chris Lattner 9282688a29 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
2010-07-05 20:41:41 +00:00
Chris Lattner 121b3facb4 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
2010-07-05 20:21:00 +00:00
Chris Lattner c721ae85ba fix a bug I introduced in r107624
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107626 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 19:36:34 +00:00
Chris Lattner fd79a9d403 rearrange some logic, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107624 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 19:17:26 +00:00
Chris Lattner 2bc00252d7 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
2010-07-05 18:03:30 +00:00
Chris Lattner 1880666c13 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
2010-07-05 17:04:23 +00:00
Argyrios Kyrtzidis c8f9af2943 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
2010-07-05 10:38:01 +00:00
Argyrios Kyrtzidis 7b081c8604 Read/write some source location for PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 10:37:55 +00:00
Jordy Rose b7e3aabf8f 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
2010-07-05 04:42:43 +00:00
Zhongxing Xu 8d26bb7249 Refrase comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107607 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 02:36:16 +00:00
Zhongxing Xu c8822e06d0 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
2010-07-05 02:35:40 +00:00
Zhongxing Xu 423030c9e7 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
2010-07-05 02:31:16 +00:00
Zhongxing Xu 139d0b3950 Indexer: make FieldDecl an internal Entity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107604 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 01:44:14 +00:00
Jordy Rose 52e04c5376 Track extents for VLAs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107603 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-05 00:50:15 +00:00
Argyrios Kyrtzidis 400f5125e2 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
2010-07-04 21:44:47 +00:00
Argyrios Kyrtzidis c91e9f439a 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
2010-07-04 21:44:35 +00:00
Argyrios Kyrtzidis 5586b019c1 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
2010-07-04 21:44:25 +00:00
Argyrios Kyrtzidis 006113841b 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
2010-07-04 21:44:19 +00:00
Argyrios Kyrtzidis 691d77f207 Write/read ParmVarDecl's UninstantiatedDefaultArg for PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107594 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-04 21:44:07 +00:00
Argyrios Kyrtzidis 9421adc438 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
2010-07-04 21:44:00 +00:00
Nick Lewycky 4d2229c7a9 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
2010-07-04 21:29:45 +00:00
Nick Lewycky a8bef693d8 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
2010-07-04 01:41:30 +00:00
Jordy Rose 32f2656b90 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
2010-07-04 00:00:41 +00:00
Benjamin Kramer 6b855121f3 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
2010-07-03 20:33:13 +00:00
John McCall 5efd91a3b5 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
2010-07-03 18:33:00 +00:00
Charles Davis 4d254836f4 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
2010-07-03 16:56:59 +00:00
John McCall c7d209fb24 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
2010-07-03 09:25:20 +00:00