diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-12-11 06:43:27 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-12-11 06:43:27 +0000 |
commit | f6d9cebafd4936608569fca477f0c1c0c68d2577 (patch) | |
tree | 4d1d0ac8ad261cedf5304238352f86639cdd391d /clang/lib/Analysis/AnalysisContext.cpp | |
parent | ff2ac71b25997ac13ab7ea50c8afc12744b1fea2 (diff) | |
download | bcm5719-llvm-f6d9cebafd4936608569fca477f0c1c0c68d2577.tar.gz bcm5719-llvm-f6d9cebafd4936608569fca477f0c1c0c68d2577.zip |
Enhance understanding of VarRegions referenced by a block whose declarations are outside the current stack frame. Fixes <rdar://problem/7462324>.
llvm-svn: 91107
Diffstat (limited to 'clang/lib/Analysis/AnalysisContext.cpp')
-rw-r--r-- | clang/lib/Analysis/AnalysisContext.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Analysis/AnalysisContext.cpp b/clang/lib/Analysis/AnalysisContext.cpp index 113587f60ed..3a6cf42a3d7 100644 --- a/clang/lib/Analysis/AnalysisContext.cpp +++ b/clang/lib/Analysis/AnalysisContext.cpp @@ -179,6 +179,19 @@ const StackFrameContext *LocationContext::getCurrentStackFrame() const { return NULL; } +const StackFrameContext * +LocationContext::getStackFrameForDeclContext(const DeclContext *DC) const { + const LocationContext *LC = this; + while (LC) { + if (const StackFrameContext *SFC = dyn_cast<StackFrameContext>(LC)) { + if (cast<DeclContext>(SFC->getDecl()) == DC) + return SFC; + } + LC = LC->getParent(); + } + return NULL; +} + //===----------------------------------------------------------------------===// // Lazily generated map to query the external variables referenced by a Block. //===----------------------------------------------------------------------===// |