diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2012-07-31 01:07:55 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-31 01:07:55 +0000 |
| commit | 42e8d6497d754b46088a9f0b20e2cb02e7cd2a5f (patch) | |
| tree | d50fbd7f6cafed98251bd9dcd72689606fe21135 /clang/lib/StaticAnalyzer/Core/Store.cpp | |
| parent | 4502b53c3b806f2fb896d074216b6c92641abfd4 (diff) | |
| download | bcm5719-llvm-42e8d6497d754b46088a9f0b20e2cb02e7cd2a5f.tar.gz bcm5719-llvm-42e8d6497d754b46088a9f0b20e2cb02e7cd2a5f.zip | |
[analyzer] Let CallEvent decide what goes in an inital stack frame.
This removes explicit checks for 'this' and 'self' from
Store::enterStackFrame. It also removes getCXXThisRegion() as a virtual
method on all CallEvents; it's now only implemented in the parts of the
hierarchy where it is relevant. Finally, it removes the option to ask
for the ParmVarDecls attached to the definition of an inlined function,
saving a recomputation of the result of getRuntimeDefinition().
No visible functionality change!
llvm-svn: 161017
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/Store.cpp')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/Store.cpp | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Store.cpp b/clang/lib/StaticAnalyzer/Core/Store.cpp index ed221c5419e..63a5e382c90 100644 --- a/clang/lib/StaticAnalyzer/Core/Store.cpp +++ b/clang/lib/StaticAnalyzer/Core/Store.cpp @@ -29,37 +29,15 @@ StoreRef StoreManager::enterStackFrame(Store OldStore, const StackFrameContext *LCtx) { StoreRef Store = StoreRef(OldStore, *this); - unsigned Idx = 0; - for (CallEvent::param_iterator I = Call.param_begin(/*UseDefinition=*/true), - E = Call.param_end(/*UseDefinition=*/true); - I != E; ++I, ++Idx) { - const ParmVarDecl *Decl = *I; - assert(Decl && "Formal parameter has no decl?"); - - SVal ArgVal = Call.getArgSVal(Idx); - if (!ArgVal.isUnknown()) { - Store = Bind(Store.getStore(), - svalBuilder.makeLoc(MRMgr.getVarRegion(Decl, LCtx)), - ArgVal); - } - } + SmallVector<CallEvent::FrameBindingTy, 16> InitialBindings; + Call.getInitialStackFrameContents(LCtx, InitialBindings); - // FIXME: We will eventually want to generalize this to handle other non- - // parameter arguments besides 'this' (such as 'self' for ObjC methods). - SVal ThisVal = Call.getCXXThisVal(); - if (isa<DefinedSVal>(ThisVal)) { - const CXXMethodDecl *MD = cast<CXXMethodDecl>(Call.getDecl()); - loc::MemRegionVal ThisRegion = svalBuilder.getCXXThis(MD, LCtx); - Store = Bind(Store.getStore(), ThisRegion, ThisVal); + for (CallEvent::BindingsTy::iterator I = InitialBindings.begin(), + E = InitialBindings.end(); + I != E; ++I) { + Store = Bind(Store.getStore(), I->first, I->second); } - if (const ObjCMethodCall *MCall = dyn_cast<ObjCMethodCall>(&Call)) { - SVal SelfVal = MCall->getReceiverSVal(); - const VarDecl *SelfDecl = LCtx->getAnalysisDeclContext()->getSelfDecl(); - Store = Bind(Store.getStore(), - svalBuilder.makeLoc(MRMgr.getVarRegion(SelfDecl, LCtx)), - SelfVal); - } return Store; } |

