From 955cd444f445bcdbade1cdd3926254c8ee7890d8 Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Tue, 14 Aug 2012 00:36:12 +0000 Subject: [PATCH] [analyzer] Add getStackFrame() to CheckerContext and ExplodedNode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161819 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h | 4 ++-- .../clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h | 4 ++++ lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index 0669b05570..8c8e82ce20 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -92,8 +92,8 @@ public: return Pred->getLocationContext(); } - const StackFrameContext *getCurrentStackFrame() const { - return getLocationContext()->getCurrentStackFrame(); + const StackFrameContext *getStackFrame() const { + return Pred->getStackFrame(); } BugReporter &getBugReporter() { diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index 40969d3fa2..1052d9491a 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -133,6 +133,10 @@ public: return getLocation().getLocationContext(); } + const StackFrameContext *getStackFrame() const { + return getLocationContext()->getCurrentStackFrame(); + } + const Decl &getCodeDecl() const { return *getLocationContext()->getDecl(); } CFG &getCFG() const { return *getLocationContext()->getCFG(); } diff --git a/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp b/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp index f22d7404c0..fea57337bb 100644 --- a/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp +++ b/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp @@ -125,7 +125,7 @@ DynamicTypePropagation::getObjectTypeForAllocAndNew(const ObjCMessageExpr *MsgE, RecE= RecE->IgnoreParenImpCasts(); if (const DeclRefExpr *DRE = dyn_cast(RecE)) { - const StackFrameContext *SFCtx = C.getCurrentStackFrame(); + const StackFrameContext *SFCtx = C.getStackFrame(); // Are we calling [self alloc]? If this is self, get the type of the // enclosing ObjC class. if (DRE->getDecl() == SFCtx->getSelfDecl()) { -- 2.40.0