summaryrefslogtreecommitdiffstats
path: root/clang/lib/Checker
Commit message (Collapse)AuthorAgeFilesLines
* Code cleanup: remove explicit flush() in favor of using the ostream's str()Jordy Rose2010-06-081-2/+1
| | | | llvm-svn: 105657
* Makefiles: Set Clang CPP compiler flags in a single location, instead of ↵Daniel Dunbar2010-06-081-2/+0
| | | | | | scattered throughout the project Makefiles. llvm-svn: 105638
* Makefile: Switch Clang Makefiles to always include the top-level Clang Makefile.Daniel Dunbar2010-06-081-2/+2
| | | | | | - This eliminates most dependencies on how Clang is installed relative to LLVM. llvm-svn: 105637
* Add a checker check if a global variable holds a local variable's address afterZhongxing Xu2010-06-084-0/+97
| | | | | | the function call is left where the local variable is declared. llvm-svn: 105602
* Catch free()s on non-regions and regions known to be not from malloc(), by ↵Jordy Rose2010-06-071-5/+180
| | | | | | checking the symbol type and memory space. llvm-svn: 105547
* Add comments.Zhongxing Xu2010-06-031-1/+2
| | | | llvm-svn: 105382
* Limit the use of BindDefault().Zhongxing Xu2010-06-011-1/+5
| | | | llvm-svn: 105265
* Add support for calloc() in MallocChecker. Patch by Jordy Rose, with my Zhongxing Xu2010-06-012-10/+49
| | | | | | modification. llvm-svn: 105264
* After conversations with Zhongxing Xu and Jordy Rose, refine the logic inTed Kremenek2010-05-311-19/+25
| | | | | | | | | RegionStoreManager::RetrieveElement() that handles indexing into a larger scalar object to only consult the direct binding of a super region if it is a scalar. This isn't perfect yet, and a big FIXME is attached to the code. This causes the test case for PR 7218 now to pass. llvm-svn: 105195
* Refactor the Is{Std,Clang,LLVM}Namespace methods and rename 'isClangAttr' toNick Lewycky2010-05-301-35/+13
| | | | | | 'IsClangAttr' to match prevailing style in this file. Patch by Jon Mulder! llvm-svn: 105170
* Convert DeclNodes to use TableGen.Alexis Hunt2010-05-301-1/+1
| | | | | | | | The macros required for DeclNodes use have changed to match the use of StmtNodes. The FooFirst enumerator constants have been named firstFoo to match usage elsewhere. llvm-svn: 105165
* Revert r105097. Thinking about a better fix.Zhongxing Xu2010-05-291-18/+5
| | | | llvm-svn: 105099
* Fix PR7218. Patch by Jordy Rose.Zhongxing Xu2010-05-291-3/+17
| | | | llvm-svn: 105097
* Discard qualifiers for ElementRegions so that a 'const' doesn't change the ↵Ted Kremenek2010-05-271-1/+1
| | | | | | | | lookup semantics in the symbol store. We may wish to push this down into the StoreManager itself. llvm-svn: 104788
* Small fix.Zhongxing Xu2010-05-261-1/+1
| | | | llvm-svn: 104669
* Remove extents of dead symbolic regions when RemoveDeadBindings.Zhongxing Xu2010-05-264-16/+25
| | | | | | This requires creating new persistent states due to the nature of GDM. llvm-svn: 104668
* CastSizeChecker checks when casting a malloc'ed symbolic region to type T,Zhongxing Xu2010-05-255-8/+98
| | | | | | | whether the size of the symbolic region is a multiple of the size of T. Fixes PR6123 and PR7217. llvm-svn: 104584
* Update retain-release checker to understand changes to how 'super' is ↵Ted Kremenek2010-05-211-7/+51
| | | | | | | | represented in the ASTs. Fixes <rdar://problem/8015556>. llvm-svn: 104389
* Pass around an error SourceRange instead of an Expr* when reporting errorsTed Kremenek2010-05-211-10/+10
| | | | | | in the Objective-C memory checker. llvm-svn: 104388
* Add clang support for IBOutletCollection.Ted Kremenek2010-05-192-2/+4
| | | | llvm-svn: 104135
* Add option '-analyzer-max-loop', which specifies the maximum Zhongxing Xu2010-05-181-2/+1
| | | | | | number of times the analyzer will go through a loop. llvm-svn: 104007
* Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointedJohn McCall2010-05-172-4/+4
| | | | | | out. The remaining ones are okay. llvm-svn: 103973
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-152-3/+4
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Relax an assertion. Various cases could lead to non-symbol values.Zhongxing Xu2010-05-131-1/+4
| | | | llvm-svn: 103707
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-111-1/+1
| | | | llvm-svn: 103517
* Fixes for compilation with Microsoft Visual Studio 2010, from Steven Watanabe!Douglas Gregor2010-05-111-1/+1
| | | | llvm-svn: 103458
* Turn -analyzer-inline-call on for C functions. This also fixed a bug thatZhongxing Xu2010-05-061-0/+26
| | | | | | after inlining post-call checking shouldn't be done. llvm-svn: 103161
* Make -analyzer-inline-call not a separate analysis. Instead it's a boolean Zhongxing Xu2010-05-061-2/+2
| | | | | | | flag now, and can be used with other analyses. Only turned it on for C++ methods for now. llvm-svn: 103160
* Unbreak CMake build.Douglas Gregor2010-05-051-0/+2
| | | | llvm-svn: 103077
* Completely reimplement __builtin_offsetof, based on a patch by RobertoDouglas Gregor2010-04-281-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Amadini. This change introduces a new expression node type, OffsetOfExpr, that describes __builtin_offsetof. Previously, __builtin_offsetof was implemented using a unary operator whose subexpression involved various synthesized array-subscript and member-reference expressions, which was ugly and made it very hard to instantiate as a template. OffsetOfExpr represents the AST more faithfully, with proper type source information and a more compact representation. OffsetOfExpr also has support for dependent __builtin_offsetof expressions; it can be value-dependent, but will never be type-dependent (like sizeof or alignof). This commit introduces template instantiation for __builtin_offsetof as well. There are two major caveats to this patch: 1) CodeGen cannot handle the case where __builtin_offsetof is not a constant expression, so it produces an error. So, to avoid regressing in C, we retain the old UnaryOperator-based __builtin_offsetof implementation in C while using the shiny new OffsetOfExpr implementation in C++. The old implementation can go away once we have proper CodeGen support for this case, which we expect won't cause much trouble in C++. 2) __builtin_offsetof doesn't work well with non-POD class types, particularly when the designated field is found within a base class. I will address this in a subsequent patch. Fixes PR5880 and a bunch of assertions when building Boost.Python tests. llvm-svn: 102542
* Introduce Type::isStructureOrClassType(), which does the obviousDouglas Gregor2010-04-265-14/+12
| | | | | | | | thing. Audit all uses of Type::isStructure(), changing those calls to isStructureOrClassType() as needed (which is alsmost everywhere). Fixes the remaining failure in Boost.Utility/Swap. llvm-svn: 102386
* CXXNamedCastExpr is actually an abstract expression.Zhongxing Xu2010-04-211-1/+0
| | | | llvm-svn: 101994
* Use the right predecessor.Zhongxing Xu2010-04-211-1/+1
| | | | llvm-svn: 101981
* Add initial support for C++ delete expr.Zhongxing Xu2010-04-212-2/+17
| | | | llvm-svn: 101980
* 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
OpenPOWER on IntegriCloud