]> granicus.if.org Git - clang/commitdiff
Add pretty-printing support for FieldRegions.
authorTed Kremenek <kremenek@apple.com>
Fri, 17 Oct 2008 21:05:44 +0000 (21:05 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 17 Oct 2008 21:05:44 +0000 (21:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57724 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/MemRegion.h
lib/Analysis/MemRegion.cpp

index fddf40d2e954a7ae77cac422e0bde406929ad2f6..69e4abb7bd545ec4fd8a3de6068a3b224e1a12a0 100644 (file)
@@ -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<FieldDecl>(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<FieldDecl>(D); }
-  QualType getType() const { return getDecl()->getType(); }
     
   static bool classof(const MemRegion* R) {
     return R->getKind() == FieldRegionKind;
index 97a4fbc295085c025048fc769a4270b5b6aaaa35..d8efef2e675d934e0d9a35a16568860e50019c05 100644 (file)
@@ -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.
 //===----------------------------------------------------------------------===//