aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
AgeCommit message (Collapse)Author
2009-06-11Add summary lookup for IOServiceGetMatchingService.Ted Kremenek
Convert tabs to spaces. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11Refactor some function name -> summary lookup using a switch statement.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05Fix:Ted Kremenek
<rdar://problem/6948053> False positive: object substitution during -init* methods warns about returning +0 when using -fobjc-gc-only git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05Enhance attribute cf_returns_retained to also work (in the analyzer)Ted Kremenek
for non-Objctive-C pointer types. This implicitly documents that the return type is a CF object reference. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72968 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20Add special cases to retain checker for 'create' methods in QCView, ↵Ted Kremenek
QCRenderer, and CIContext (Apple APIs). This fixes: <rdar://problem/6902710> clang: false positives w/QC and CoreImage methods. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72187 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18Fix PR 4230: Don't flag leaks of NSAutoreleasePools until we know that we ↵Ted Kremenek
aren' at the top-most scope of autorelease pools. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72065 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-16Fix: <rdar://problem/6893565> False positive: don't flag leaks for return ↵Ted Kremenek
types that cannot be determined to be CF types git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71921 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15Fix crash when deriving the enclosing summary of a method whose first ↵Ted Kremenek
selector slot has a null IdentifierInfo*. This happens when analyzing Growl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15Remove extra whitespace character in string literal. Purely cosmetic.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71847 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-14Fix <rdar://problem/6859457> [NSData dataWithBytesNoCopy] does not return a ↵Ted Kremenek
retained object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71797 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-13Fix crasher reported in PR 4209 caused by an invalid summaryTed Kremenek
generation when EvalObjCMessageExpr() did not resolve the ObjCInterfaceDecl* for a receiver when the receiver's symbolic value wasn't being explicitly tracked. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-13Fix crasher in CFRefCount.cpp reported by Nikita Zhuk due to recently added ↵Ted Kremenek
autorelease tracking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12Fix: <rdar://problem/6320065> false positive - init method returns an object ↵Ted Kremenek
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
2009-05-12Add logic for invalidating array region to CFRefCount.cpp. When invalidatingZhongxing Xu
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
2009-05-12Fix <rdar://problem/6877235> Classes typedef-ed to CF objects should get the ↵Ted Kremenek
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
2009-05-11When stripping element regions for invalidating region values, treat ↵Ted Kremenek
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
2009-05-11Fix regression reported in <rdar://problem/6866843>. The analyzer should ↵Ted Kremenek
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
2009-05-11Fix a bug found by Thomas Clement where 'return [[[NSString alloc] init] ↵Ted Kremenek
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
2009-05-11TypedRegion is a too general assumption. Usually we only want to invalidateZhongxing Xu
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
2009-05-10Add special warning about returning a retained object where a GC'ed object ↵Ted Kremenek
is expected. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71397 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-10retain/release checker: Flag a warning for non-owned objects returnedTed Kremenek
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
2009-05-10analyzer:Ted Kremenek
- 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
2009-05-09As discussed with Ted, rename TypedRegion::getObjectType() to Zhongxing Xu
TypedRegion::getValueType(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09Add back analyzer support for ns_returns_retained and cf_returns_retained.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71309 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09It lives! The retain/release checker now tracks objects that are sentTed Kremenek
'autorelease'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09rename: MemRegion:Zhongxing Xu
RValueType => ObjectType LValueType => LocationType No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09More hacking on autorelease errors. We now can emit basic errors (disabled forTed Kremenek
now until ready). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71303 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09Put most of the boilerplate logic in place for reporting autorelease errors.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71301 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08retain/release checker: Add stub for HandleAutoreleaseCounts.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71290 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08retain/release checker: Refactor error-reporting code in EvalDeadSymbols andTed Kremenek
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
2009-05-08retain checker: Track the number of times a tracked object is sentTed Kremenek
'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
2009-05-08Remove experimental ownership attributes from Clang.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71216 91177308-0d34-0410-b5e6-96231b3b80d8
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