summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Analysis/PathSensitive/MemRegion.h11
-rw-r--r--clang/lib/Analysis/MemRegion.cpp5
2 files changed, 12 insertions, 4 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/MemRegion.h b/clang/include/clang/Analysis/PathSensitive/MemRegion.h
index fddf40d2e95..69e4abb7bd5 100644
--- a/clang/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/clang/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<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;
diff --git a/clang/lib/Analysis/MemRegion.cpp b/clang/lib/Analysis/MemRegion.cpp
index 97a4fbc2950..d8efef2e675 100644
--- a/clang/lib/Analysis/MemRegion.cpp
+++ b/clang/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.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud