}
};
-class ElementRegion : public SubRegion {
+class ElementRegion : public TypedRegion {
friend class MemRegionManager;
SVal Index;
ElementRegion(SVal Idx, const MemRegion* sReg)
- : SubRegion(sReg, ElementRegionKind), Index(Idx) {}
+ : TypedRegion(sReg, ElementRegionKind), Index(Idx) {}
static void ProfileRegion(llvm::FoldingSetNodeID& ID, SVal Idx,
const MemRegion* superRegion);
SVal getIndex() const { return Index; }
+ QualType getType(ASTContext&) const;
+
void print(llvm::raw_ostream& os) const;
void Profile(llvm::FoldingSetNodeID& ID) const;
void ElementRegion::Profile(llvm::FoldingSetNodeID& ID) const {
ElementRegion::ProfileRegion(ID, Index, superRegion);
}
+
+QualType ElementRegion::getType(ASTContext& C) const {
+ QualType T = cast<TypedRegion>(superRegion)->getType(C);
+ ArrayType* AT = cast<ArrayType>(T.getTypePtr());
+ return AT->getElementType();
+}
+
//===----------------------------------------------------------------------===//
// Region pretty-printing.
//===----------------------------------------------------------------------===//