summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/BasicStore.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Completely remove ObjCObjectRegion (tests pass this time).Ted Kremenek2009-12-161-9/+8
| | | | llvm-svn: 91572
* Temporarily revert 91553.Ted Kremenek2009-12-161-5/+9
| | | | llvm-svn: 91557
* Remove use of ObjCObjectRegion from BasicStoreManager.Ted Kremenek2009-12-161-9/+5
| | | | llvm-svn: 91553
* Add analysis support for blocks. This includes a few key changes:Ted Kremenek2009-12-071-6/+2
| | | | | | | | | | | | | | | | | - Refactor the MemRegion hierarchy to distinguish between different StackSpaceRegions for locals and parameters. - VarRegions for "captured" variables now have the BlockDataRegion as their super region (except those passed by reference) - Add transfer function support to GRExprEngine for BlockDeclRefExprs. This change also supports analyzing blocks as an analysis entry point (top-of-the-stack), which required pushing more context-sensitivity around in the MemRegion hierarchy via the use of LocationContext objects. Functionally almost everything is the same, except we track LocationContexts in a few more areas and StackSpaceRegions now refer to a StackFrameContext object. In the future we will need to modify MemRegionManager to allow multiple StackSpaceRegions in flight at once (for the analysis of multiple stack frames). llvm-svn: 90809
* Replace SymbolReaper::isLive(VarDecl) with SymbolReaper::isLive(VarRegion).Ted Kremenek2009-12-041-1/+1
| | | | llvm-svn: 90582
* lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespaceKovarththanan Rajaratnam2009-11-281-3/+2
| | | | llvm-svn: 90028
* * Do the same thing to the basicstore as in r84163.Zhongxing Xu2009-11-161-15/+2
| | | | | | | | | | * Add a load type to GRExprEngine::EvalLoad(). * When retrieve from 'theValue' of OSAtomic funcitions, use the type of the region instead of the argument expression as the load type. * Then we can convert CastRetrievedSVal to a pure assertion. In the future we can let all Retrieve() methods simply return SVal. llvm-svn: 88888
* Rename: StripCasts describes what it does better. Zhongxing Xu2009-11-101-1/+1
| | | | | | getBaseRegion will be used in another method. llvm-svn: 86649
* Refactor StoreManager::BindDecl() to take a VarRegion* instead of a ↵Ted Kremenek2009-11-041-14/+12
| | | | | | VarDecl*, and modify GRExprEngine::EvalBind() to handle decl initialization as well. This paves the way for adding "checker" visitation in EvalBind(). llvm-svn: 85983
* retain/release checker: Stop tracking reference counts for any symbols ↵Ted Kremenek2009-10-161-2/+12
| | | | | | | | touched by StoreManager::InvalidateRegion(). This fixes <rdar://problem/7257223> and <rdar://problem/7283470>. llvm-svn: 84223
* * Remove unused GRState* parameterZhongxing Xu2009-10-141-22/+13
| | | | | | * Make all Base value the last argument. llvm-svn: 84071
* Fix:Ted Kremenek2009-09-271-1/+1
| | | | | | | | | | | | | | | | <rdar://problem/6914474> checker doesn't realize that variable might have been assigned if a pointer to that variable was passed to another function via a structure The problem here was the RegionStoreManager::InvalidateRegion didn't invalidate the bindings of invalidated regions. This required a rewrite of this method using a worklist. As part of this fix, changed ValueManager::getConjuredSymbolVal() to require a 'void*' SymbolTag argument. This tag is used to differentiate two different symbols created at the same location. llvm-svn: 82920
* Introduce "DefinedOrUnknownSVal" into the SVal class hierarchy, providing a wayTed Kremenek2009-09-111-3/+3
| | | | | | | | | | | | to statically type various methods in SValuator/GRState as required either a defined value or a defined-but-possibly-unknown value. This leads to various logic cleanups in GRExprEngine, and lets the compiler enforce via type checking our assumptions about what symbolic values are possibly undefined and what are not. Along the way, clean up some of the static analyzer diagnostics regarding the uses of uninitialized values. llvm-svn: 81579
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-96/+96
| | | | llvm-svn: 81346
* Fix regression in BasicStoreManager caused by implicitly casting loaded ↵Ted Kremenek2009-08-251-5/+9
| | | | | | values and trying to load/store from arrays. RegionStoreManager already properly handles these cases well; we just need to gracefully not handle this case in BasicStoreManager. This fixes PR 4781. llvm-svn: 80051
* Fix crash reported in <rdar://problem/7124210> by "back-porting" some of theTed Kremenek2009-08-251-3/+7
| | | | | | | implicit cast logic in RegionStoreManager to BasicStoreManager. This involved moving CastRetriedVal from RegionStoreManager to StoreManager. llvm-svn: 80026
* Replace cerr with errs().Benjamin Kramer2009-08-231-2/+1
| | | | llvm-svn: 79854
* Remove 'SelfRegion' field from both BasicStoreManager and RegionStoreManager.Ted Kremenek2009-08-211-31/+16
| | | | | | | | | | | | | | | | | | 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
* Add LocationContext* field to VarRegion. This is needed for interprocedural ↵Ted Kremenek2009-08-211-19/+26
| | | | | | analysis. llvm-svn: 79680
* Get the code decl from the initial location context.Zhongxing Xu2009-08-211-1/+1
| | | | llvm-svn: 79590
* To make the analysis independent on the locally stored liveness and cfgZhongxing Xu2009-08-171-3/+4
| | | | | | | of GRStateManager and GRExprEngine, pass the initial location context to the getInitialState() method. llvm-svn: 79228
* Generalize the interface of 'StoreManager::RemoveDeadBindings()' to ↵Ted Kremenek2009-08-021-12/+11
| | | | | | manipulate the entire GRState, not just the Store. llvm-svn: 77870
* Change uses of:Ted Kremenek2009-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | 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 'StoreManager::OldCastRegion()', TypedViewRegion (which onlyTed Kremenek2009-07-291-8/+2
| | | | | | | OldCastRegion used), and the associated command line option '-analyzer-store=old-basic-cast'. llvm-svn: 77509
* Make StoreManager::InvalidateRegion() virtual, move the current implementationTed Kremenek2009-07-291-1/+28
| | | | | | | | | | in StoreManager to RegionStoreManager, and create a special, highly reduced version in BasicStoreManager. These changes are in preparation for future RegionStore-specific changes to InvalidateRegion. llvm-svn: 77483
* Fix PR 4594 by refactoring almost all casting logic from GRExprEngine::VisitCastTed Kremenek2009-07-211-10/+12
| | | | | | | | | to SValuator::EvalCast. In the process, the StoreManagers now use this new cast machinery, and the hack in GRExprEngine::EvalBind to handle implicit casts involving OSAtomicCompareAndSwap and friends has been removed (and replaced with logic closer to the logic specific to those functions). llvm-svn: 76641
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-1/+1
| | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Fix <rdar://problem/7062158> by having BasicStoreManager model values for ↵Ted Kremenek2009-07-151-4/+0
| | | | | | 'static' global variables. llvm-svn: 75844
* Tidy pretty-printing for SVals, using 'dump()' instead of 'printStdErr()', ↵Ted Kremenek2009-07-131-2/+1
| | | | | | and implementing operator<< support for llvm::raw_ostream. llvm-svn: 75560
* Switch BasicStoreManager to use the new CastRegion implementation by default,Ted Kremenek2009-07-101-3/+3
| | | | | | | | and replace the 'clang-cc' option '-analyzer-store=basic-new-cast' with '-analyzer-store=basic-old-cast'. We'll keep the old CastRegion implementation around for a little while for regression testing. llvm-svn: 75209
* Make 'BasicStoreManager' + 'NewCastRegion' testable from the command line ↵Ted Kremenek2009-07-061-2/+6
| | | | | | using '-analyzer-store=basic-new-cast'. llvm-svn: 74865
* BasicStoreManager: Use SymbolManager::canSymbolicate() to determine if a ↵Ted Kremenek2009-07-031-1/+1
| | | | | | variable can be symbolicated. llvm-svn: 74750
* StoreManagers: Use 'hasGlobalsStorage()' and 'hasParametersStorage()' instead ofTed Kremenek2009-07-021-4/+3
| | | | | | | directly consulting if a VarDecl is an implicit or actual parameter, a global, etc. llvm-svn: 74716
* Combine two conditional branches into one. No functionality change.Ted Kremenek2009-06-301-8/+4
| | | | llvm-svn: 74552
* We do not require the super region of element region be typed. So do notZhongxing Xu2009-06-301-3/+2
| | | | | | create TypedViewRegion for it. llvm-svn: 74516
* 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
* Do not crash on binding concrete integer location.Zhongxing Xu2009-06-281-0/+3
| | | | llvm-svn: 74407
* Simplify some code. As in region store, we always expect the location is aZhongxing Xu2009-06-281-41/+34
| | | | | | memregion. llvm-svn: 74406
* Remove uses of std::ostream from libAnalysis.Ted Kremenek2009-06-241-5/+7
| | | | llvm-svn: 74136
* Remove GRStateManager::getRegion/getSelfRegion().Ted Kremenek2009-06-231-1/+1
| | | | llvm-svn: 74006
* Move all factory methods from SVal to ValueManager. API cleanup!Zhongxing Xu2009-06-231-13/+13
| | | | 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
* Start moving in the direction of removing GRStateRef. Now eachTed Kremenek2009-06-171-32/+27
| | | | | | | | GRState object has a direct reference to its GRStateManager, making the functionality of GRStateRef redunandant. This will lead to some nice API cleanup and code shrinking across libAnalysis. llvm-svn: 73644
* Use canonical type for building ElementRegion. Otherwise ElementRegions cannotZhongxing Xu2009-06-161-1/+1
| | | | | | be unique. llvm-svn: 73482
* Rename:Zhongxing Xu2009-05-091-2/+2
| | | | | | | SymbolRegionRValue => SymbolRegionValue SymExpr::RegionRValue => SymExpr::RegionValueKind llvm-svn: 71322
* As discussed with Ted, rename TypedRegion::getObjectType() to Zhongxing Xu2009-05-091-1/+1
| | | | | | TypedRegion::getValueType(). llvm-svn: 71321
* rename: MemRegion:Zhongxing Xu2009-05-091-3/+3
| | | | | | | | | RValueType => ObjectType LValueType => LocationType No functionality change. llvm-svn: 71304
* Fix unused variable warningTed Kremenek2009-05-051-1/+1
| | | | llvm-svn: 70946
* Remove possibly incorrect assertion that doesn't matter.Ted Kremenek2009-05-051-3/+0
| | | | llvm-svn: 70943
OpenPOWER on IntegriCloud