aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
AgeCommit message (Collapse)Author
2009-07-06Start to gradually move region invalidation code into store manager.Zhongxing Xu
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74812 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30De-ASTContext-ify DeclContext.Argyrios Kyrtzidis
Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30Remove the ASTContext parameter from the getBody() methods of Decl and ↵Argyrios Kyrtzidis
subclasses. Timings showed no significant difference before and after the commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74504 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-30Remove the ASTContext parameter from the attribute-related methods of Decl.Argyrios Kyrtzidis
The implementations of these methods can Use Decl::getASTContext() to get the ASTContext. This commit touches a lot of files since call sites for these methods are everywhere. I used pre-tokenized "carbon.h" and "cocoa.h" headers to do some timings, and there was no real time difference between before the commit and after it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29Invalidate the alloca region by setting its default value to conjured symbol.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-28Invalidate a field of struct type by setting its default value to conjured Zhongxing Xu
symbol. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74408 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26Introduce a new concept to the static analyzer: SValuator.Ted Kremenek
GRTransferFuncs had the conflated role of both constructing SVals (symbolic expressions) as well as handling checker-specific logic. Now SValuator has the role of constructing SVals from expressions and GRTransferFuncs just handles checker-specific logic. The motivation is by separating these two concepts we will be able to much more easily create richer constraint-generating logic without coupling it to the main checker transfer function logic. We now have one implementation of SValuator: SimpleSValuator. SimpleSValuator is essentially the SVal-related logic that was in GRSimpleVals (which is removed in this patch). This includes the logic for EvalBinOp, EvalCast, etc. Because SValuator has a narrower role than the old GRTransferFuncs, the interfaces are much simpler, and so is the implementation of SimpleSValuator compared to GRSimpleVals. I also did a line-by-line review of SVal-related logic in GRSimpleVals and cleaned it up while moving it over to SimpleSValuator. As a consequence of removing GRSimpleVals, there is no longer a '-checker-simple' option. The '-checker-cfref' did everything that option did but also ran the retain/release checker. Of course a user may not always wish to run the retain/release checker, nor do we wish core analysis logic buried in the checker-specific logic. The next step is to refactor the logic in CFRefCount.cpp to separate out these pieces into the core analysis engine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74229 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24Remove uses of std::ostream from libAnalysis.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74136 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23Remove GRStateManager::getRegion/getSelfRegion().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74006 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to ↵Ted Kremenek
MemRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23Move all factory methods from SVal to ValueManager. API cleanup!Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73954 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23MemRegions:Ted Kremenek
- Embed a reference to MemRegionManager objects in MemSpaceRegion objects - Use this embedded reference for MemRegion objects to access ASTContext objects without external help - Use this access to ASTContext to simplify 'isBoundable' (no ASTContext& argument required) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18Move clients over from using GRStateManager::BindXXX and friends toTed Kremenek
GRState->bindXXX and friends (and constify some arguments along the way). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18libAnalysis:Ted Kremenek
- Remove the 'isFeasible' flag from all uses of 'Assume'. - Remove the 'Assume' methods from GRStateManager. Now the only way to create a new GRState with an assumption is to use the new 'assume' methods in GRState. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18Remove more dependencies on GRStateRef. As a consequence, we can nowTed Kremenek
pretty-print a GRState object anywhere it is referenced (instead of needing a GRStateRef of a GRStateManager handy). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73669 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18Remove another dependency on GRStateRef.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73667 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15Fix: <rdar://problem/6945561> -[CIContext createCGLayerWithSize:info:] ↵Ted Kremenek
misinterpreted by clang scan-build git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73415 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15Fix: <rdar://problem/6961230> add knowledge of IOKit functions to ↵Ted Kremenek
retain/release checker git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73411 91177308-0d34-0410-b5e6-96231b3b80d8
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