[cfe-commits] r61924 - in /cfe/trunk: include/clang/Analysis/PathSensitive/MemRegion.h lib/Analysis/MemRegion.cpp
Zhongxing Xu
xuzhongxing at gmail.com
Thu Jan 8 05:17:16 PST 2009
Author: zhongxingxu
Date: Thu Jan 8 07:17:14 2009
New Revision: 61924
URL: http://llvm.org/viewvc/llvm-project?rev=61924&view=rev
Log:
Add isSubRegionOf() method to SubRegion.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
cfe/trunk/lib/Analysis/MemRegion.cpp
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=61924&r1=61923&r2=61924&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Thu Jan 8 07:17:14 2009
@@ -100,6 +100,8 @@
return superRegion;
}
+ bool isSubRegionOf(const MemRegion* R) const;
+
static bool classof(const MemRegion* R) {
return R->getKind() > SymbolicRegionKind;
}
Modified: cfe/trunk/lib/Analysis/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=61924&r1=61923&r2=61924&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/MemRegion.cpp (original)
+++ cfe/trunk/lib/Analysis/MemRegion.cpp Thu Jan 8 07:17:14 2009
@@ -21,6 +21,19 @@
MemRegion::~MemRegion() {}
+bool SubRegion::isSubRegionOf(const MemRegion* R) const {
+ const MemRegion* r = getSuperRegion();
+ while (r != 0) {
+ if (r == R)
+ return true;
+ if (const SubRegion* sr = dyn_cast<SubRegion>(r))
+ r = sr->getSuperRegion();
+ else
+ break;
+ }
+ return false;
+}
+
void MemSpaceRegion::Profile(llvm::FoldingSetNodeID& ID) const {
ID.AddInteger((unsigned)getKind());
}
More information about the cfe-commits
mailing list