From: Ted Kremenek Date: Fri, 17 Oct 2008 21:05:44 +0000 (+0000) Subject: Add pretty-printing support for FieldRegions. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4bd1eefd48c70ebef185e524d0484c00f16000cf;p=clang Add pretty-printing support for FieldRegions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57724 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h index fddf40d2e9..69e4abb7bd 100644 --- a/include/clang/Analysis/PathSensitive/MemRegion.h +++ b/include/clang/Analysis/PathSensitive/MemRegion.h @@ -220,14 +220,17 @@ class FieldRegion : public DeclRegion { FieldRegion(const FieldDecl* fd, const MemRegion* sReg) : DeclRegion(fd, sReg, FieldRegionKind) {} +public: + + void print(llvm::raw_ostream& os) const; + + const FieldDecl* getDecl() const { return cast(D); } + QualType getType() const { return getDecl()->getType(); } + static void ProfileRegion(llvm::FoldingSetNodeID& ID, FieldDecl* FD, const MemRegion* superRegion) { DeclRegion::ProfileRegion(ID, FD, superRegion, FieldRegionKind); } - -public: - const FieldDecl* getDecl() const { return cast(D); } - QualType getType() const { return getDecl()->getType(); } static bool classof(const MemRegion* R) { return R->getKind() == FieldRegionKind; diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp index 97a4fbc295..d8efef2e67 100644 --- a/lib/Analysis/MemRegion.cpp +++ b/lib/Analysis/MemRegion.cpp @@ -88,6 +88,11 @@ void SymbolicRegion::print(llvm::raw_ostream& os) const { os << "$" << sym.getNumber(); } +void FieldRegion::print(llvm::raw_ostream& os) const { + superRegion->print(os); + os << "->" << getDecl()->getName(); +} + //===----------------------------------------------------------------------===// // MemRegionManager methods. //===----------------------------------------------------------------------===//