aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-10-24 06:30:07 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-10-24 06:30:07 +0000
commitb21ff77c8126ea628b66d2ffb931fdaa7884f5d2 (patch)
tree41051a8f1cac519135d75013026b60a66865abb9
parent6c308cc40a587f515c10b0af34f0bd160bb5c04d (diff)
Add printing method to ElementRegion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58077 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathSensitive/MemRegion.h4
-rw-r--r--lib/Analysis/MemRegion.cpp5
2 files changed, 9 insertions, 0 deletions
diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h
index ff419a8e06..a78059dfed 100644
--- a/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/include/clang/Analysis/PathSensitive/MemRegion.h
@@ -54,9 +54,11 @@ public:
virtual void Profile(llvm::FoldingSetNodeID& ID) const = 0;
std::string getString() const;
+
virtual void print(llvm::raw_ostream& os) const;
Kind getKind() const { return kind; }
+
static bool classof(const MemRegion*) { return true; }
};
@@ -275,6 +277,8 @@ public:
SVal getIndex() const { return Index; }
+ void print(llvm::raw_ostream& os) const;
+
void Profile(llvm::FoldingSetNodeID& ID) const;
static bool classof(const MemRegion* R) {
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index cae053f595..9c76e452e8 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -103,6 +103,11 @@ void FieldRegion::print(llvm::raw_ostream& os) const {
os << "->" << getDecl()->getName();
}
+void ElementRegion::print(llvm::raw_ostream& os) const {
+ superRegion->print(os);
+ os << '['; Index.print(os); os << ']';
+}
+
//===----------------------------------------------------------------------===//
// MemRegionManager methods.
//===----------------------------------------------------------------------===//