An ElementRegion is really a typed region. Its super region's type has to be ArrayType.

llvm-svn: 58245
This commit is contained in:
Zhongxing Xu committed 2008-10-27 13:17:02 +00:00
1 parent 89ebcb9d8d
commit 7b700575dd
2 files changed
+11 -2

No files matched your search

@@ -327,13 +327,13 @@ public:
}
};
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);
@@ -342,6 +342,8 @@ public:
SVal getIndex() const { return Index; }
QualType getType(ASTContext&) const;
void print(llvm::raw_ostream& os) const;
void Profile(llvm::FoldingSetNodeID& ID) const;
+7
View File
@@ -83,6 +83,13 @@ void ElementRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, SVal Idx,
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.
//===----------------------------------------------------------------------===//