From b21ff77c8126ea628b66d2ffb931fdaa7884f5d2 Mon Sep 17 00:00:00 2001 From: Zhongxing Xu Date: Fri, 24 Oct 2008 06:30:07 +0000 Subject: [PATCH] Add printing method to ElementRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58077 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Analysis/PathSensitive/MemRegion.h | 4 ++++ lib/Analysis/MemRegion.cpp | 5 +++++ 2 files changed, 9 insertions(+) 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. //===----------------------------------------------------------------------===// -- 2.40.0