summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker
Commit message (Collapse)AuthorAgeFilesLines
...
* Overhaul the AST representation of Objective-C message sendDouglas Gregor2010-04-217-74/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expressions, to improve source-location information, clarify the actual receiver of the message, and pave the way for proper C++ support. The ObjCMessageExpr node represents four different kinds of message sends in a single AST node: 1) Send to a object instance described by an expression (e.g., [x method:5]) 2) Send to a class described by the class name (e.g., [NSString method:5]) 3) Send to a superclass class (e.g, [super method:5] in class method) 4) Send to a superclass instance (e.g., [super method:5] in instance method) Previously these four cases where tangled together. Now, they have more distinct representations. Specific changes: 1) Unchanged; the object instance is represented by an Expr*. 2) Previously stored the ObjCInterfaceDecl* referring to the class receiving the message. Now stores a TypeSourceInfo* so that we know how the class was spelled. This both maintains typedef information and opens the door for more complicated C++ types (e.g., dependent types). There was an alternative, unused representation of these sends by naming the class via an IdentifierInfo *. In practice, we either had an ObjCInterfaceDecl *, from which we would get the IdentifierInfo *, or we fell into the case below... 3) Previously represented by a class message whose IdentifierInfo * referred to "super". Sema and CodeGen would use isStr("super") to determine if they had a send to super. Now represented as a "class super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). 4) Previously represented by an instance message whose receiver is a an ObjCSuperExpr, which Sema and CodeGen would check for via isa<ObjCSuperExpr>(). Now represented as an "instance super" send, where we have both the location of the "super" keyword and the ObjCInterfaceDecl* of the superclass we're targetting (statically). Note that ObjCSuperExpr only has one remaining use in the AST, which is for "super.prop" references. The new representation of ObjCMessageExpr is 2 pointers smaller than the old one, since it combines more storage. It also eliminates a leak when we loaded message-send expressions from a precompiled header. The representation also feels much cleaner to me; comments welcome! This patch attempts to maintain the same semantics we previously had with Objective-C message sends. In several places, there are massive changes that boil down to simply replacing a nested-if structure such as: if (message has a receiver expression) { // instance message if (isa<ObjCSuperExpr>(...)) { // send to super } else { // send to an object } } else { // class message if (name->isStr("super")) { // class send to super } else { // send to class } } with a switch switch (E->getReceiverKind()) { case ObjCMessageExpr::SuperInstance: ... case ObjCMessageExpr::Instance: ... case ObjCMessageExpr::SuperClass: ... case ObjCMessageExpr::Class:... } There are quite a few places (particularly in the checkers) where send-to-super is effectively ignored. I've placed FIXMEs in most of them, and attempted to address send-to-super in a reasonable way. This could use some review. llvm-svn: 101972
* Replace code with a method call. No functionality change.Zhongxing Xu2010-04-201-65/+8
| | | | llvm-svn: 101876
* Use GetState() to get the possible cleaned state.Zhongxing Xu2010-04-201-3/+3
| | | | llvm-svn: 101867
* Improve handling of CXXNewExpr.Zhongxing Xu2010-04-201-7/+62
| | | | llvm-svn: 101862
* Fix -Wcast-qual warnings.Dan Gohman2010-04-191-1/+2
| | | | llvm-svn: 101786
* Move all C++ expression evaluation logic into its own file.Zhongxing Xu2010-04-193-234/+238
| | | | llvm-svn: 101772
* Analyzer: add support for CXXNewExpr.Zhongxing Xu2010-04-193-11/+40
| | | | llvm-svn: 101771
* Add raw_ostream operators to NamedDecl for convenience. Switch over all ↵Benjamin Kramer2010-04-1710-29/+23
| | | | | | | | users of getNameAsString on a stream. The next step is to print the name directly into the stream, avoiding a temporary std::string copy. llvm-svn: 101632
* Static analyzer: Don't crash when casting a symbolic region address to a ↵Ted Kremenek2010-04-161-8/+14
| | | | | | float. Fixes PR 6854. llvm-svn: 101499
* Fix PR 6844, a regression caused by the introduction of llvm_unreachable for ↵Ted Kremenek2010-04-151-25/+61
| | | | | | | | | | the default case in GRExprEngine::Visit (in r101129). Instead, enumerate all Stmt cases and have no 'default' case in the switch statement. When we encounter a Stmt we don't handle, we should explicitly add it to the switch statement. llvm-svn: 101378
* Move GRStmtNodeBuilder::MakeNode() out of line. No functionality change.Zhongxing Xu2010-04-141-0/+27
| | | | llvm-svn: 101239
* Add support for CXXBoolLiteralExpr.Zhongxing Xu2010-04-142-1/+9
| | | | llvm-svn: 101238
* Make all cases that we don't handle explicit. Zhongxing Xu2010-04-131-1/+12
| | | | llvm-svn: 101129
* Dispatch all C++ cast expr to VisitCast().Zhongxing Xu2010-04-131-7/+6
| | | | llvm-svn: 101128
* Remove copy of 'Optional' in Clang tree, and convert clients to use the one ↵Ted Kremenek2010-04-092-10/+11
| | | | | | now in the LLVM tree. llvm-svn: 100891
* For 'open' check in UnixAPIChecker, hard code value of 'O_CREAT' on Darwin.Ted Kremenek2010-04-081-18/+34
| | | | | | | This is still not an ideal solution, but should disable the check for other targets where the value of O_CREAT is different. llvm-svn: 100818
* Temporarily only enable 'open' check on Mac OS X to unbreak Windows ↵Ted Kremenek2010-04-081-0/+7
| | | | | | | | buildbot. I'm looking into an alternate fix right now. llvm-svn: 100816
* Add static analyzer check for calls to 'pthread_once()' where the ↵Ted Kremenek2010-04-081-0/+45
| | | | | | | | control-flow has automatic storage. This matches the corresponding check for 'dispatch_once()'. llvm-svn: 100803
* Fix crash in StoreManager::CastRegion() when the base region is a type with ↵Ted Kremenek2010-04-071-7/+8
| | | | | | 0 size. llvm-svn: 100594
* Teach MemRegion::getBaseRegion() about ObjCIvarRegions. We want to treatTed Kremenek2010-04-061-7/+8
| | | | | | | them the same way as fields. This fixes a regression in RegionStore::RemoveDeadbindings() that emerged from going to the cluster-based analysis. llvm-svn: 100570
* Fix PR 6725. It looks like the copy constructor gets elided during inlining.Zhongxing Xu2010-04-061-1/+1
| | | | | | This bug only shows up with GCC 4.4.1 Release-Asserts build. llvm-svn: 100516
* Always assume block-level expressions in the caller are alive when analyzingZhongxing Xu2010-04-051-2/+29
| | | | | | the callee. llvm-svn: 100429
* Since now we process regions in clusters when removing dead bindings, thisZhongxing Xu2010-04-051-8/+0
| | | | | | code can be removed. llvm-svn: 100428
* Use the element type to compute the array size when the base region is a ↵Zhongxing Xu2010-04-011-3/+6
| | | | | | | | VarRegion. Patch by Jordy Rose. llvm-svn: 100099
* Initial support for visiting CXXMemberCallExpr.Zhongxing Xu2010-04-011-5/+88
| | | | llvm-svn: 100098
* Improve C++ constructor handling.Zhongxing Xu2010-04-012-2/+5
| | | | llvm-svn: 100080
* Fix a bug (PR 6699) in RegionStore::RemoveDeadBindings() whereTed Kremenek2010-04-011-32/+31
| | | | | | array values with a non-zero offset would get prematurely pruned from the store. llvm-svn: 100067
* Reinstate my CodeModificationHint -> FixItHint renaming patch, withoutDouglas Gregor2010-03-311-2/+2
| | | | | | the C-only "optimization". llvm-svn: 100022
* Revert r100008, which inexplicably breaks the clang-i686-darwin10 builderDouglas Gregor2010-03-311-2/+2
| | | | llvm-svn: 100018
* Rename CodeModificationHint to FixItHint, since we've been using theDouglas Gregor2010-03-311-2/+2
| | | | | | | term "fix-it" everywhere and even *I* get tired of long names sometimes. No functionality change. llvm-svn: 100008
* Introduce a new kind of derived-to-base cast which bypasses the need forJohn McCall2010-03-301-0/+1
| | | | | | | null checks, and make sure we elide null checks when accessing base class members. llvm-svn: 99963
* RegionStore: specially handle loads from integer global variables declared ↵Ted Kremenek2010-03-301-1/+16
| | | | | | | | 'const'. Fixes a false positive reported in PR 6288. llvm-svn: 99922
* Use 'const Optional<SVal>&' to avoid an extra copy.Ted Kremenek2010-03-301-8/+8
| | | | llvm-svn: 99921
* the big refactoring bits of PR3782.Rafael Espindola2010-03-301-1/+1
| | | | | | | | This introduces FunctionType::ExtInfo to hold the calling convention and the noreturn attribute. The next patch will extend it to include the regparm attribute and fix the bug. llvm-svn: 99920
* Change the analyzer to recognize (but ignore) assignments to isa. Fixes PR ↵Ted Kremenek2010-03-301-0/+5
| | | | | | 6302. llvm-svn: 99904
* Be a bit more consistent in using operator->Rafael Espindola2010-03-291-1/+1
| | | | | | | This patch moves some methods from QualType to Type and changes the users to use -> instead of . llvm-svn: 99805
* Checker: random include cleanup.Benjamin Kramer2010-03-2732-43/+49
| | | | llvm-svn: 99731
* Fix NoReturnFunctionChecker to properly look at a function's typeTed Kremenek2010-03-261-41/+41
| | | | | | when determining if it returns. Fixes <rdar://problem/7796563>. llvm-svn: 99663
* Add methods to remove a GDM entry.Zhongxing Xu2010-03-252-1/+13
| | | | | | Instead of setting the ReturnExpr GDM to NULL, remove it. llvm-svn: 99470
* Use llvm::SmallString instead of std::string.Ted Kremenek2010-03-241-20/+15
| | | | llvm-svn: 99442
* Improve static analyzer diagnostic concerning the use of 'mktemp'Ted Kremenek2010-03-241-3/+2
| | | | llvm-svn: 99441
* Bind the constructed object value to CXXConstructExpr.Zhongxing Xu2010-03-232-7/+24
| | | | llvm-svn: 99271
* update CMakeLists.txtZhongxing Xu2010-03-231-0/+1
| | | | llvm-svn: 99269
* Clear the return expr GDM after using it.Zhongxing Xu2010-03-231-1/+4
| | | | llvm-svn: 99268
* Add a AggExprVisitor class. It contains lots of boilerZhongxing Xu2010-03-232-0/+58
| | | | | | plate code for evaluating expressions of C++ class type. llvm-svn: 99267
* merge line.Zhongxing Xu2010-03-231-4/+1
| | | | llvm-svn: 99259
* Since we now may have basicblocks with the same block is in different function,Zhongxing Xu2010-03-233-12/+46
| | | | | | | change the block counter map from unsigned -> unsigned to <StackFrameContext*, unsigned> -> unsigned. llvm-svn: 99255
* Tweak null dereference diagnostics to give clearer diagnostics whenTed Kremenek2010-03-231-17/+38
| | | | | | a null dereference results from a field access. llvm-svn: 99236
* Improve the diagnostics for the UndefinedAssignmentChecker when anTed Kremenek2010-03-221-11/+27
| | | | | | uninitialized value is used in the LHS of a compound assignment. llvm-svn: 99221
* Sort calls to add_clang_library()Kovarththanan Rajaratnam2010-03-221-8/+8
| | | | llvm-svn: 99191
OpenPOWER on IntegriCloud