aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
AgeCommit message (Collapse)Author
2008-07-15Support retain/release tracking for CoreGraphics (CGxxxRef) objects.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53617 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10Refactored most of the "Store" piece of ValueState into a Store type. TheTed Kremenek
current store implementation is now encapsulated by BasicStore. These changes prompted some long due constification of ValueState. Much of the diffs in this patch include adding "const" qualifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09Fix PR2519: correctly handle CFDictionaryCreate.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-07Updated clients of ImmutableMap::SlimFind to use ImmutableMap::lookup instead.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-03Use conjured symbols for variables whose values are invalidated whenTed Kremenek
passed-by-reference to a function. This allows us to build up constraints for their new values and restore some lost path-sensitivity. This addresses a few false positives since in Adium. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02Refactored some of the BugReporter interface so that data such as the ↵Ted Kremenek
ASTContext&, PathDiagnosticClient*, can be provided by an external source. Split BugReporter into BugReporter and GRBugReporter so checkers not based on GRExprEngine can still use the BugReporter mechanism. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01Unlike NSWindow objects, NSPanel objects initially do not have self-ownership.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-01Temporarily treat "Autorelease" as "StopTracking". This is the original ↵Ted Kremenek
behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52940 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-30Added "Autorelease" ArgEffect to better simulate "autorelease" messages. RightTed Kremenek
now this does the same thing as "MayEscape", but more functionality will go in here shortly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25CF ref checker:Ted Kremenek
Tracked objects now have their type information tracked with them. Enhanced summaries for ObjC methods to include the type information of the receiver. Used the enhanced summaries to support the idiom that NSWindow owns itself (it sends a release message to itself upon close). Added some comments. Did some cleanups with the checker logic using operator overloading (reduced redundant code which I was concerned about being the source of bugs). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52741 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24Remove unneeded method arguments.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24Cache ObjC summaries by IdentifierInfo*, not by ObjCInterfaceDecl.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23Added ObjCSummaryCache, a new summary cache object to cache summaries for ↵Ted Kremenek
Objective-C methods. Instead of mapping from Selectors -> Summaries, we will now map from (ObjCInterfaceDecl*,Selectors) -> Summaries. This will allow more nuanced summary generation. This patch just swaps in the new data structure; the rest of the code works as before by allowing the ObjCInterfaceDecl* to be null. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52653 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23Rename summary methods for "instance methods" to "class methods" (the names ↵Ted Kremenek
got screwed up). No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52650 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23The CF retain/release checker now assumes that allocations do not fail. ↵Ted Kremenek
Eventually we will add a flag to the driver to enable allocation failures (documented as a FIXME). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17This patch is motivated by numerous strict-aliasing warnings when compilingTed Kremenek
clang as a Release build. The big change is that all AST nodes (subclasses of Stmt) whose children are Expr* store their children as Stmt* or arrays of Stmt*. This is to remove strict-aliasing warnings when using StmtIterator. None of the interfaces of any of the classes have changed (except those with arg_iterators, see below), as the accessor methods introduce the needed casts (via cast<>). While this extra casting may seem cumbersome, it actually adds some important sanity checks throughout the codebase, as clients using StmtIterator can potentially overwrite children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts provide extra sanity checks that are operational in debug builds to catch invariant violations such as these. For classes that have arg_iterators (e.g., CallExpr), the definition of arg_iterator has been replaced. Instead of it being Expr**, it is an actual class (called ExprIterator) that wraps a Stmt**, and provides the necessary operators for iteration. The nice thing about this class is that it also uses cast<> to type-checking, which introduces extra sanity checks throughout the codebase that are useful for debugging. A few of the CodeGen functions that use arg_iterator (especially from OverloadExpr) have been modified to take begin and end iterators instead of a base Expr** and the number of arguments. This matches more with the abstraction of iteration. This still needs to be cleaned up a little bit, as clients expect that ExprIterator is a RandomAccessIterator (which we may or may not wish to allow for efficiency of representation). This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c, which was already broken) on both a Debug and Release build, but it should obviously be reviewed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52378 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02Teach the CF retain checker about "_init" methods. Fixes: ↵Ted Kremenek
<rdar://problem/5956379> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51872 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22Prototyped support in the BugReporter to emit diagnostics of the form "p now ↵Ted Kremenek
aliases q". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-22Expand retain/release checker to consider methods/function calls that cause aTed Kremenek
tracked object to "escape": it's reference count might be incremented by the called function, thus causing an object's lifetime to extend beyond when the local reference count is decremented to 0. This addresses: <rdar://problem/5933215> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-16Cache leaks by the allocation site, not the leak location.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51198 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09Rename IsPointerType to LVal::IsLValType, and update CFRefCount::EvalSummary ↵Ted Kremenek
to use IsLValType when conjuring symbols for return values (this fixes a bug with an assertion firing in the analyzer when two qualified objective-c types were compared). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07Added support for "drain".Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07Expand the CF retain checker to allow the Create/Get rule to apply to anyTed Kremenek
function that returns a CFxxxRef, not just functions whose name begins with CF. This implements <rdar://problem/5917879>. Added test case for this feature. Updated calls to CStrInCStrNoCase to swap their arguments, per compatibility with strcasestr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50829 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07Flip order of arguments to CStrInStrNoCase.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07Use llvm::CStrInCStrNoCase instead of strcasestr, since the latter is not ↵Ted Kremenek
portable. Correctly check if the result of CStrInCStrNoCase is NULL to generate summaries; before we were inverting the condition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07copy-paste: NS types are not typedefs.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07Do not treat **instance** methods "copyWithZone:" and "mutableCopyWithZone:" ↵Ted Kremenek
from NSObject as allocators. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07Be less promiscuous with generating summaries for "new", "copy", "create".Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50798 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-07Added auto-summary generation for createXXX, copyXXX, newXXX methods.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Don't report leaks for autoreleased objects.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06More comments.Ted Kremenek
"#if 0" out some assumptions when auto-generating method summaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50772 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Experiment with not converting bug names to lower case.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50753 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Generate "stop" summaries for selectors involving receivers whose type is ↵Ted Kremenek
not NSxxxx. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Use strncmp correctly.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Make string comparison legible and remove buffer overrun introduced by typo.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06String comparison cleanups.Ted Kremenek
Added test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Fix logic error in string processing.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Remove assertion.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Use EvalSummary to process message expressions, thereby unifying the checkerTed Kremenek
logic for function calls and message expressions. Use the following heuristic to infer "allocating" instance methods: [ClassName classWithXXX] allocates an object Update testcase to reflect this heuristic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Added receiver effects to EvalSummary.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50700 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Expand summaries to include "Receiver" effects.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Added initialization code to generate initial set of ObjC method summaries ↵Ted Kremenek
(non-instance methods). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-06Added code to generate initial set of summaries for instance methods.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05Add summary generation for "initXXX" methods.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05Make CF retain diagnostics more succinct.Ted Kremenek
In a leak's "name", indicate GC or non-GC bugs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05Initial work on refactoring the CFRefCount checker so that it is moreTed Kremenek
generic and handles reference counts for NSObjects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05Improve leak diagnostics to not report a leak on the same line where Ted Kremenek
the object was last used. This can be confusing to users. For example: // 'y' is leaked x = foo(y); instead: x = foo(y); // 'y' is leaked git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50661 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05Improved leak diagnostics.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05Minor refactorings/cleanups in CF retain checker and added support for ↵Ted Kremenek
NSMakeCollectable. Added test case for NSMakeCollectable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50653 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02Improved diagnostics for leaks: now we report which variable was leaked.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50588 91177308-0d34-0410-b5e6-96231b3b80d8