[cfe-commits] r96471 - in /cfe/trunk: include/clang/Analysis/AnalysisContext.h lib/Analysis/AnalysisContext.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Wed Feb 17 00:45:06 PST 2010
Author: zhongxingxu
Date: Wed Feb 17 02:45:06 2010
New Revision: 96471
URL: http://llvm.org/viewvc/llvm-project?rev=96471&view=rev
Log:
Add a utility method.
Modified:
cfe/trunk/include/clang/Analysis/AnalysisContext.h
cfe/trunk/lib/Analysis/AnalysisContext.cpp
Modified: cfe/trunk/include/clang/Analysis/AnalysisContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/AnalysisContext.h?rev=96471&r1=96470&r2=96471&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/AnalysisContext.h (original)
+++ cfe/trunk/include/clang/Analysis/AnalysisContext.h Wed Feb 17 02:45:06 2010
@@ -110,6 +110,8 @@
const LocationContext *getParent() const { return Parent; }
+ bool isParentOf(const LocationContext *LC) const;
+
const Decl *getDecl() const { return getAnalysisContext()->getDecl(); }
CFG *getCFG() const { return getAnalysisContext()->getCFG(); }
Modified: cfe/trunk/lib/Analysis/AnalysisContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisContext.cpp?rev=96471&r1=96470&r2=96471&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/AnalysisContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisContext.cpp Wed Feb 17 02:45:06 2010
@@ -186,6 +186,18 @@
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.
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list