Kind getKind() const { return kind; }
+ template<typename RegionTy> const RegionTy* getAs() const;
+
virtual bool isBoundable(ASTContext&) const { return true; }
static bool classof(const MemRegion*) { return true; }
return R->getKind() == ElementRegionKind;
}
};
+
+template<typename RegionTy>
+const RegionTy* MemRegion::getAs() const {
+ const MemRegion *R = this;
+
+ do {
+ if (const RegionTy* RT = dyn_cast<RegionTy>(R))
+ return RT;
+
+ if (const TypedViewRegion *TR = dyn_cast<TypedViewRegion>(R)) {
+ R = TR->getSuperRegion();
+ continue;
+ }
+
+ break;
+ }
+ while (R);
+
+ return 0;
+}
//===----------------------------------------------------------------------===//
// MemRegionManager - Factory object for creating regions.
private:
MemSpaceRegion* LazyAllocate(MemSpaceRegion*& region);
-};
+};
} // end clang namespace
namespace llvm {