aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/AnalysisContext.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2010-02-17 08:45:06 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2010-02-17 08:45:06 +0000
commit8ddf7cead8a67342a4584a203e0bf736b7efedbe (patch)
treeb200ceefd541b725a9ffbcfabe0401207f36310d /lib/Analysis/AnalysisContext.cpp
parent435c43932e1285d393da35892a80b1ba3b62a0a4 (diff)
Add a utility method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AnalysisContext.cpp')
-rw-r--r--lib/Analysis/AnalysisContext.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp
index ccd5088f2e..d9933e85cb 100644
--- a/lib/Analysis/AnalysisContext.cpp
+++ b/lib/Analysis/AnalysisContext.cpp
@@ -186,6 +186,18 @@ LocationContext::getStackFrameForDeclContext(const DeclContext *DC) const {
return NULL;
}
+bool LocationContext::isParentOf(const LocationContext *LC) const {
+ do {
+ const LocationContext *Parent = LC->getParent();
+ if (Parent == this)
+ return true;
+ else
+ LC = Parent;
+ } while (LC);
+
+ return false;
+}
+
//===----------------------------------------------------------------------===//
// Lazily generated map to query the external variables referenced by a Block.
//===----------------------------------------------------------------------===//