aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/AnalysisContext.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-12-11 06:43:27 +0000
committerTed Kremenek <kremenek@apple.com>2009-12-11 06:43:27 +0000
commit2b87ae45e129b941d0a4d221c9d4842385a119bd (patch)
tree25d052be3aaf688c995b9292988d2fe4a8a125cd /lib/Analysis/AnalysisContext.cpp
parenta49c6b7da5684e061612de70b62fe892b67f35c4 (diff)
Enhance understanding of VarRegions referenced by a block whose declarations are outside the current stack frame. Fixes <rdar://problem/7462324>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AnalysisContext.cpp')
-rw-r--r--lib/Analysis/AnalysisContext.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp
index 113587f60e..3a6cf42a3d 100644
--- a/lib/Analysis/AnalysisContext.cpp
+++ b/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.
//===----------------------------------------------------------------------===//