aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
AgeCommit message (Collapse)Author
2009-05-07Minor code cleanup in retain/release checker in preparation for someTed Kremenek
other changes. Instead of repeatedly checking for GC mode when getting the return effect, just do this computation once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71193 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06Refactor BugReporter interface to have a new 'BugReporterContext' andTed Kremenek
'BugReporterVisitor'. This simplifies callbacks from BugReporter to BugReports (via VisitNode). It also lays the foundation for arbitrary visitor "call backs" that can be registered to a BugReporterContext as a PathDiagnostic is constructed. These call backs can help operate as separate "experts" that can work on constructed pieces of a PathDiagnostic for which they possess special knowledge. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71121 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06Fix analyzer regression reported in PR 4164:Ted Kremenek
- Update the old StoreManager::CastRegion to strip off 'ElementRegions' when casting to void* (Zhongxing: please validate) - Pass-by-reference argument invalidation logic in CFRefCount.cpp: - Strip ElementRegions when the ElementRegion is just a 'raw data' view on top of the underlying typed region. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71094 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05Implement attribute 'ns_autorelease'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70990 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-05Implement attribute 'cf_returns_owned' (mirrors 'ns_returns_owned').Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04Remove experimental attribute 'ns_ownership_make_collectable.'Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04Rename attributes 'objc_ownership...' to 'ns_ownership...'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04Rename attributes:Ted Kremenek
'objc_ownership_cfretain' -> 'cf_ownership_retain' 'objc_ownership_cfrelease' -> 'cf_ownership_release' Motivation: Core Foundation objects can be used in isolation from Objective-C, and this forces users to reason about the separate semantics of CF objects. More Sema support pending. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04retain checker: Add checker support for FunctionDecl ownership annotations. ↵Ted Kremenek
Need to add Sema support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70873 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04retain checker: Pull out logic for parameter annotations into aTed Kremenek
separate method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70870 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04retain checker: Don't treat function's declared in macros differently.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04retain checker:Ted Kremenek
- Fix retain checker test failures. - Update retain checker to have annotations override default summary effects, not completely redefine them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04retain checker: RetainSummaryManager now has a 'DefaultSummary' objectTed Kremenek
which is returned instead of a null pointer. This helps centralize the logic concerning "default effects". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04retain checker: Don't bother using a FoldingSet to unique summaries.Ted Kremenek
We never compare summaries by their pointers, and we create only a handful of them when analyzing a given function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70824 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03Fix: <rdar://problem/6850275> CF objects returned from methods with "new" or ↵Ted Kremenek
"copy" in their name should be treated as owned For methods that follow the "fundamental rule" and return Core Foundation objects, treat those objects as owned by the caller. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70665 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03Convert ArgEffects from an std::vector to an ImmutableMap. This will make ↵Ted Kremenek
it much easier to clean up the summary generation logic with annotations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70660 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03Rename isTrackedObjectType() -> isTrackedObjCObjectType().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-02retain/release checker: Enhance leak description to say that the bugTed Kremenek
occurs in GC mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70638 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30retain/release checker: Hook up attributes 'objc_ownership_retain' andTed Kremenek
'objc_ownership_release' to the effects on receivers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70507 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30Handle case in EvalReturn where we cache out in the ExplodedGraph.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70475 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30retain/release checker: Use the ObjCMethodDecl in the @implementation if noTed Kremenek
matching ObjCMethodDecl exists in the @interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70474 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-30retain/release checker: Resolve method decl in @interface after getting theTed Kremenek
ObjCInterfaceDecl, not before. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70473 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29retain/release checker: When determining whether an analyzed method can returnTed Kremenek
an owned object, consult its summary instead of inspecting the selector. This picks up annotations, and is just more general. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70429 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29Format cleanup. No functionality change.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29Reformat long line. No functionality change.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70412 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29retain/release checker: Hoist code for bug reports above transfer function logicTed Kremenek
(those diffs are just code moving) and move the logic for "return of owned object" leak reporting to EvalReturnStmt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29Add version of getMethodSummary() that can be used to query the summary for theTed Kremenek
method currently being analyzed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70388 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29Rename getMethodSummary() -> getInstanceMethodSummary().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70387 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29retain/release checker: Refactor getMethodSummary() to not depend on ↵Ted Kremenek
ObjCMessageExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29As discussed with Ted offline, re-apply r70293.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29retain/release checker: Refactor the guts of getClassMethodSummary to not dependTed Kremenek
on ObjCMessageExpr. This will enable us to use it elsewhere. This should not change any functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28Implement ownership attribute 'objc_ownership_make_collectable'. This allows oneTed Kremenek
to add 'CFMakeCollectable' semantics to a method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28Revert 70293.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-28Now we can remove the 'blast-through' code.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27Add two new checker-specific attributes: 'objc_ownership_release' andTed Kremenek
'objc_ownership_cfrelease'. These are the 'release' equivalents of 'objc_ownership_retain' and 'objc_ownership_cfretain' respectively. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27Track objects in GC mode returned by 'alloc', 'new', etc. methods. These areTed Kremenek
treated as "not owned" objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-27Add new checker-specific attribute 'objc_ownership_cfretain'. This is the sameTed Kremenek
as 'objc_ownership_cfretain' except that the method acts like a CFRetain instead of a [... retain] (important in GC modes). Checker support is wired up, but currently only for Objective-C message expressions (not function calls). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-26Implement function-try-blocks. However, there's a very subtle bug that I ↵Sebastian Redl
can't track down. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25Hook up attribute 'objc_ownership_retain' to the analyzer. This attribute allowsTed Kremenek
users to specify that a method's argument is visibly retained (reference count incremented). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70008 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24Hook up __attribute__((objc_ownership_returns)) to the retain/release checker.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24Fix the same false positive reported in PR 2542 and <rdar://problem/6793409>Ted Kremenek
involving an NSAnimation object delegating its release to a delegate method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24Minor refactoring: pass selector to getCommonMethodSummary(). No functionalityTed Kremenek
change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24retain/release checker: more hacks to workaround false positives cause byTed Kremenek
delegates. When a reference counted object is passed as to a 'void*' argument to a method stop tracking the reference count. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24Sentence case bug name.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69983 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-24retain/release checker:Ted Kremenek
- Fix summary lookup for class methods to now use the (optional) ObjCInterfaceDecl associated with a message expression. This removes a long-standing FIXME. - Partial fix for <rdar://problem/6062730> by stop tracking objects that are passed to [NSObject performSelector]. These methods are often used for delegates, which the analyzer doesn't reason about well yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23Refactor common logic in getMethodSummary() and getClassMethodSummary(). NoTed Kremenek
functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23Further cleanups to isTrackedObjectType().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23retain/release checker: Don't call isTrackedObject() with the canonical type.Ted Kremenek
This was preventing the checker from tracking return objects referenced by 'id'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69922 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23retain/release checker: For class methods, only treat return values that areTed Kremenek
object references as tracked objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-23Per discussions with Ken Ferry and Paul Marks (<rdar://problem/6815234>) greatlyTed Kremenek
extend the number of objects tracked by the retain/release checker by assuming that all class and instance methods should follow Cocoa object "getter" and "alloc/new" conventions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69908 91177308-0d34-0410-b5e6-96231b3b80d8