summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove 'SelfRegion' field from both BasicStoreManager and RegionStoreManager.Ted Kremenek2009-08-211-7/+13
| | | | | | | | | | | | | | | | | | SelfRegion represented the object bound to 'self' (when analyzing Objective-C methods) upon entry to a method. Having this region stored on the side ignores the current stack frame that we might be analyzing (among other things), and is a problem for interprocedural analysis. For RegionStoreManager, the value for SelfRegion is just lazily created. For BasicStoreManager, the value for SelfRegion is bound eagerly to 'self', but no explicit tracking of SelfRegion on the side is made. As part of this change, remove the restriction in BasicStoreManager that we only track ivars for 'self'. This shouldn't actually change anything in terms of precision, and simplifies the logic. llvm-svn: 79694
* retain/release checker: Treat NSObject method '-awakeAfterUsingCoder:'Ted Kremenek2009-08-201-4/+9
| | | | | | just as if it behaved like an init function. This fixes <rdar://problem/7129086>. llvm-svn: 79515
* retain/release checker: Special case handling of CFAttributedStringSetAttribute,Ted Kremenek2009-08-201-4/+6
| | | | | | | fixing <rdar://problem/7152619>. Along the way, merge test cases in 'test/Analysis/rdar-6539791.c' into 'test/Analysis/retain-release.m'. llvm-svn: 79499
* Remove unused parameter BugReporter due to previous patch.Zhongxing Xu2009-08-181-4/+2
| | | | llvm-svn: 79328
* Extend the ProgramPoint to include the context information LocationContext,Zhongxing Xu2009-08-151-4/+7
| | | | | | | which is either a stack frame context of the function or a local scope context. llvm-svn: 79072
* Last step of template cleanup: merge *BuilderImpl to *Builder.Zhongxing Xu2009-08-061-25/+25
| | | | | | Some Builders need further cleanup. llvm-svn: 78301
* As GRState seems general enough, it is time to merge some template classes Zhongxing Xu2009-08-061-63/+63
| | | | | | | and their impl base classes. This can greatly simply some code of the core analysis engine. This patch merges ExplodedNodeImpl into ExplodedNode. llvm-svn: 78270
* Get rid of "smart" quotes. Per report on cfe-dev.Eli Friedman2009-08-051-1/+1
| | | | llvm-svn: 78230
* Change uses of:Ted Kremenek2009-07-291-3/+3
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Remove some uses of TypedViewRegion, and use getBaseRegion() in a context whereTed Kremenek2009-07-291-1/+1
| | | | | | we don't care about ElementRegions layered on top of a base region. llvm-svn: 77484
* Refactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.Ted Kremenek2009-07-221-12/+13
| | | | | | | | | | | | Educate GRExprEngine::VisitGraph() about 'PreStmt'. Mark the constructor of 'PostStmt' to be explicit, preventing implicit conversions and the selection of the wrong 'generateNode' method in GRStmtNodeBuilder. Constify a bunch of arguments, which falls out of the changes to ProgramPoint. llvm-svn: 76809
* Fix long-lurking bug in ObjCSummaryCache revealed by Torok's recent memoryTed Kremenek2009-07-211-41/+38
| | | | | | | poisoning changes to DenseMap. We were using an iterator after it had been invalidated by an insertion into the DenseMap. llvm-svn: 76677
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-3/+3
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.Ted Kremenek2009-07-161-3/+3
| | | | | | | | | | | | | | | | | | | | | This method is intended to eventually replace the individual Type::getAsXXXType<> methods. The motivation behind this change is twofold: 1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of them are basically copy-and-paste. 2) By centralizing the implementation of the getAs<Type> logic we can more smoothly move over to Doug Gregor's proposed canonical type smart pointer scheme. Along with this patch: a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>. b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>. llvm-svn: 76098
* Remove ASTContext::isObjCObjectPointerType().Steve Naroff2009-07-161-1/+1
| | | | | | Convert all clients to use the new predicate on Type. llvm-svn: 76076
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-101-55/+39
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Remove dead code.Zhongxing Xu2009-07-091-1/+0
| | | | llvm-svn: 75127
* Fix <rdar://problem/7033733>. The CF_RETURNS_RETAINED attribute should work ↵Ted Kremenek2009-07-061-3/+11
| | | | | | if the return type on an Objective-C method is a CF type reference, not just an Objective-C object reference. llvm-svn: 74841
* Further cleanup of region invalidation code. No functionality change.Zhongxing Xu2009-07-061-47/+39
| | | | llvm-svn: 74816
* Start to gradually move region invalidation code into store manager.Zhongxing Xu2009-07-061-66/+3
| | | | | | No functionality change. llvm-svn: 74812
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-7/+6
| | | | | | | 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. llvm-svn: 74506
* Remove the ASTContext parameter from the getBody() methods of Decl and ↵Argyrios Kyrtzidis2009-06-301-1/+1
| | | | | | | | subclasses. Timings showed no significant difference before and after the commit. llvm-svn: 74504
* Remove the ASTContext parameter from the attribute-related methods of Decl.Argyrios Kyrtzidis2009-06-301-5/+5
| | | | | | | | | 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. llvm-svn: 74501
* Invalidate the alloca region by setting its default value to conjured symbol.Zhongxing Xu2009-06-291-2/+11
| | | | llvm-svn: 74419
* Invalidate a field of struct type by setting its default value to conjured Zhongxing Xu2009-06-281-4/+15
| | | | | | symbol. llvm-svn: 74408
* Introduce a new concept to the static analyzer: SValuator.Ted Kremenek2009-06-261-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 74229
* Remove uses of std::ostream from libAnalysis.Ted Kremenek2009-06-241-8/+7
| | | | llvm-svn: 74136
* Remove GRStateManager::getRegion/getSelfRegion().Ted Kremenek2009-06-231-1/+1
| | | | llvm-svn: 74006
* Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to ↵Ted Kremenek2009-06-231-1/+1
| | | | | | MemRegion. llvm-svn: 73973
* Move all factory methods from SVal to ValueManager. API cleanup!Zhongxing Xu2009-06-231-4/+4
| | | | llvm-svn: 73954
* MemRegions:Ted Kremenek2009-06-231-1/+1
| | | | | | | | - 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) llvm-svn: 73935
* Move clients over from using GRStateManager::BindXXX and friends toTed Kremenek2009-06-181-2/+2
| | | | | | GRState->bindXXX and friends (and constify some arguments along the way). llvm-svn: 73740
* libAnalysis:Ted Kremenek2009-06-181-8/+5
| | | | | | | | | - 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. llvm-svn: 73731
* Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.Douglas Gregor2009-06-181-5/+5
| | | | llvm-svn: 73702
* Remove more dependencies on GRStateRef. As a consequence, we can nowTed Kremenek2009-06-181-90/+86
| | | | | | | pretty-print a GRState object anywhere it is referenced (instead of needing a GRStateRef of a GRStateManager handy). llvm-svn: 73669
* Remove another dependency on GRStateRef.Ted Kremenek2009-06-181-10/+7
| | | | llvm-svn: 73667
* Fix: <rdar://problem/6945561> -[CIContext createCGLayerWithSize:info:] ↵Ted Kremenek2009-06-151-2/+5
| | | | | | misinterpreted by clang scan-build llvm-svn: 73415
* Fix: <rdar://problem/6961230> add knowledge of IOKit functions to ↵Ted Kremenek2009-06-151-3/+57
| | | | | | retain/release checker llvm-svn: 73411
* Add summary lookup for IOServiceGetMatchingService.Ted Kremenek2009-06-111-37/+48
| | | | | | Convert tabs to spaces. llvm-svn: 73198
* Refactor some function name -> summary lookup using a switch statement.Ted Kremenek2009-06-111-18/+25
| | | | llvm-svn: 73197
* Fix:Ted Kremenek2009-06-051-5/+9
| | | | | | <rdar://problem/6948053> False positive: object substitution during -init* methods warns about returning +0 when using -fobjc-gc-only llvm-svn: 72971
* Enhance attribute cf_returns_retained to also work (in the analyzer)Ted Kremenek2009-06-051-2/+9
| | | | | | | for non-Objctive-C pointer types. This implicitly documents that the return type is a CF object reference. llvm-svn: 72968
* Add special cases to retain checker for 'create' methods in QCView, ↵Ted Kremenek2009-05-201-4/+16
| | | | | | | | | | QCRenderer, and CIContext (Apple APIs). This fixes: <rdar://problem/6902710> clang: false positives w/QC and CoreImage methods. llvm-svn: 72187
* Fix PR 4230: Don't flag leaks of NSAutoreleasePools until we know that we ↵Ted Kremenek2009-05-181-0/+4
| | | | | | aren' at the top-most scope of autorelease pools. llvm-svn: 72065
* Fix: <rdar://problem/6893565> False positive: don't flag leaks for return ↵Ted Kremenek2009-05-161-19/+28
| | | | | | types that cannot be determined to be CF types llvm-svn: 71921
* Fix crash when deriving the enclosing summary of a method whose first ↵Ted Kremenek2009-05-151-12/+16
| | | | | | selector slot has a null IdentifierInfo*. This happens when analyzing Growl. llvm-svn: 71857
* Remove extra whitespace character in string literal. Purely cosmetic.Ted Kremenek2009-05-151-1/+1
| | | | llvm-svn: 71847
* Fix <rdar://problem/6859457> [NSData dataWithBytesNoCopy] does not return a ↵Ted Kremenek2009-05-141-0/+9
| | | | | | retained object. llvm-svn: 71797
* Fix crasher reported in PR 4209 caused by an invalid summaryTed Kremenek2009-05-131-4/+16
| | | | | | | | generation when EvalObjCMessageExpr() did not resolve the ObjCInterfaceDecl* for a receiver when the receiver's symbolic value wasn't being explicitly tracked. llvm-svn: 71685
* Fix crasher in CFRefCount.cpp reported by Nikita Zhuk due to recently added ↵Ted Kremenek2009-05-131-2/+5
| | | | | | autorelease tracking. llvm-svn: 71647
OpenPOWER on IntegriCloud