summaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
Commit message (Collapse)AuthorAge
...
* Fix: <rdar://problem/6320065> false positive - init method returns an object ↵Ted Kremenek2009-05-12
| | | | | | | | | | owned by caller Now 'init' methods are treated by the retain/release checker as claiming their receiver and allocating a new object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71579 91177308-0d34-0410-b5e6-96231b3b80d8
* Add logic for invalidating array region to CFRefCount.cpp. When invalidatingZhongxing Xu2009-05-12
| | | | | | | | | | array region, set its default value to conjured symbol. When retrieving its element, create new region value symbol for the element. Also fix some 80 columns violations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71548 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix <rdar://problem/6877235> Classes typedef-ed to CF objects should get the ↵Ted Kremenek2009-05-12
| | | | | | | | | same treatment as CF objects This was accomplished by having 'isTypeRef' recursively walk the typedef stack. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71538 91177308-0d34-0410-b5e6-96231b3b80d8
* When stripping element regions for invalidating region values, treat ↵Ted Kremenek2009-05-11
| | | | | | FieldRegions and ObjCIvarRegions as "base" regions in addition to VarRegions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71488 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix regression reported in <rdar://problem/6866843>. The analyzer should ↵Ted Kremenek2009-05-11
| | | | | | extend the lifetime of an object stored to a container. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71452 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bug found by Thomas Clement where 'return [[[NSString alloc] init] ↵Ted Kremenek2009-05-11
| | | | | | autorelease]' would emit a false 'too many overreleases' error. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71432 91177308-0d34-0410-b5e6-96231b3b80d8
* TypedRegion is a too general assumption. Usually we only want to invalidateZhongxing Xu2009-05-11
| | | | | | | the VarRegion as a super region of an ElementRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71431 91177308-0d34-0410-b5e6-96231b3b80d8
* Add special warning about returning a retained object where a GC'ed object ↵Ted Kremenek2009-05-10
| | | | | | is expected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71397 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Flag a warning for non-owned objects returnedTed Kremenek2009-05-10
| | | | | | | | | where an owned one is expected. Also add preliminary checking for returning a positive retain count object in GC mode where an owned GC object is expected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71388 91177308-0d34-0410-b5e6-96231b3b80d8
* analyzer:Ted Kremenek2009-05-10
| | | | | | | | | - Improve -autorelease diagnostics. - Improve VLA diagnostics. - Use "short description" for bug when outputting to TextDiagnostics git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71383 91177308-0d34-0410-b5e6-96231b3b80d8
* As discussed with Ted, rename TypedRegion::getObjectType() to Zhongxing Xu2009-05-09
| | | | | | | TypedRegion::getValueType(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71321 91177308-0d34-0410-b5e6-96231b3b80d8
* Add back analyzer support for ns_returns_retained and cf_returns_retained.Ted Kremenek2009-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71309 91177308-0d34-0410-b5e6-96231b3b80d8
* It lives! The retain/release checker now tracks objects that are sentTed Kremenek2009-05-09
| | | | | | | 'autorelease'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71307 91177308-0d34-0410-b5e6-96231b3b80d8
* rename: MemRegion:Zhongxing Xu2009-05-09
| | | | | | | | | | RValueType => ObjectType LValueType => LocationType No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71304 91177308-0d34-0410-b5e6-96231b3b80d8
* More hacking on autorelease errors. We now can emit basic errors (disabled forTed Kremenek2009-05-09
| | | | | | | now until ready). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71303 91177308-0d34-0410-b5e6-96231b3b80d8
* Put most of the boilerplate logic in place for reporting autorelease errors.Ted Kremenek2009-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71301 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Add stub for HandleAutoreleaseCounts.Ted Kremenek2009-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71290 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Refactor error-reporting code in EvalDeadSymbols andTed Kremenek2009-05-08
| | | | | | | EvalEndPath. This sets the stage for handling autorelease counts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71283 91177308-0d34-0410-b5e6-96231b3b80d8
* retain checker: Track the number of times a tracked object is sentTed Kremenek2009-05-08
| | | | | | | 'autorelease'. This isn't used yet to flag errors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71244 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove experimental ownership attributes from Clang.Ted Kremenek2009-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71216 91177308-0d34-0410-b5e6-96231b3b80d8
* Minor code cleanup in retain/release checker in preparation for someTed Kremenek2009-05-07
| | | | | | | | 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
* Refactor BugReporter interface to have a new 'BugReporterContext' andTed Kremenek2009-05-06
| | | | | | | | | | | | '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
* Fix analyzer regression reported in PR 4164:Ted Kremenek2009-05-06
| | | | | | | | | | | - 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
* Implement attribute 'ns_autorelease'.Ted Kremenek2009-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70990 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement attribute 'cf_returns_owned' (mirrors 'ns_returns_owned').Ted Kremenek2009-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70952 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove experimental attribute 'ns_ownership_make_collectable.'Ted Kremenek2009-05-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70940 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename attributes 'objc_ownership...' to 'ns_ownership...'.Ted Kremenek2009-05-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70897 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename attributes:Ted Kremenek2009-05-04
| | | | | | | | | | | | | '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
* retain checker: Add checker support for FunctionDecl ownership annotations. ↵Ted Kremenek2009-05-04
| | | | | | Need to add Sema support. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70873 91177308-0d34-0410-b5e6-96231b3b80d8
* retain checker: Pull out logic for parameter annotations into aTed Kremenek2009-05-04
| | | | | | | separate method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70870 91177308-0d34-0410-b5e6-96231b3b80d8
* retain checker: Don't treat function's declared in macros differently.Ted Kremenek2009-05-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70869 91177308-0d34-0410-b5e6-96231b3b80d8
* retain checker:Ted Kremenek2009-05-04
| | | | | | | | - 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
* retain checker: RetainSummaryManager now has a 'DefaultSummary' objectTed Kremenek2009-05-04
| | | | | | | | 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
* retain checker: Don't bother using a FoldingSet to unique summaries.Ted Kremenek2009-05-04
| | | | | | | | 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
* Fix: <rdar://problem/6850275> CF objects returned from methods with "new" or ↵Ted Kremenek2009-05-03
| | | | | | | | | | "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
* Convert ArgEffects from an std::vector to an ImmutableMap. This will make ↵Ted Kremenek2009-05-03
| | | | | | 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
* Rename isTrackedObjectType() -> isTrackedObjCObjectType().Ted Kremenek2009-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70657 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Enhance leak description to say that the bugTed Kremenek2009-05-02
| | | | | | | occurs in GC mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70638 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Hook up attributes 'objc_ownership_retain' andTed Kremenek2009-04-30
| | | | | | | '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
* Handle case in EvalReturn where we cache out in the ExplodedGraph.Ted Kremenek2009-04-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70475 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Use the ObjCMethodDecl in the @implementation if noTed Kremenek2009-04-30
| | | | | | | matching ObjCMethodDecl exists in the @interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70474 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Resolve method decl in @interface after getting theTed Kremenek2009-04-30
| | | | | | | ObjCInterfaceDecl, not before. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70473 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: When determining whether an analyzed method can returnTed Kremenek2009-04-29
| | | | | | | | 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
* Format cleanup. No functionality change.Ted Kremenek2009-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70420 91177308-0d34-0410-b5e6-96231b3b80d8
* Reformat long line. No functionality change.Ted Kremenek2009-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70412 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Hoist code for bug reports above transfer function logicTed Kremenek2009-04-29
| | | | | | | | (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
* Add version of getMethodSummary() that can be used to query the summary for theTed Kremenek2009-04-29
| | | | | | | method currently being analyzed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70388 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getMethodSummary() -> getInstanceMethodSummary().Ted Kremenek2009-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70387 91177308-0d34-0410-b5e6-96231b3b80d8
* retain/release checker: Refactor getMethodSummary() to not depend on ↵Ted Kremenek2009-04-29
| | | | | | ObjCMessageExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70369 91177308-0d34-0410-b5e6-96231b3b80d8
* As discussed with Ted offline, re-apply r70293.Zhongxing Xu2009-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70358 91177308-0d34-0410-b5e6-96231b3b80d8