aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/MemRegion.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-04-15 22:37:59 +0000
committerAnna Zaks <ganna@apple.com>2013-04-15 22:37:59 +0000
commit79d0cceb8847bfe6dc9da8eb2ea2f3c6bb73b813 (patch)
tree83170652722a35f727caa8d147d324a8b32cc400 /lib/StaticAnalyzer/Core/MemRegion.cpp
parent82dd4396fcd2517d06382b7170f393d1b6351c7f (diff)
[analyzer] Address code review for r179395
Mostly refactoring + handle the nested fields by printing the innermost field only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/MemRegion.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/MemRegion.cpp39
1 files changed, 24 insertions, 15 deletions
diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp
index e244d31afa..32e7f7713b 100644
--- a/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -558,16 +558,20 @@ bool MemRegion::canPrintPretty() const {
return false;
}
+bool MemRegion::canPrintPrettyAsExpr() const {
+ return canPrintPretty();
+}
+
void MemRegion::printPretty(raw_ostream &os) const {
assert(canPrintPretty() && "This region cannot be printed pretty.");
os << "'";
- printPrettyNoQuotes(os);
+ printPrettyAsExpr(os);
os << "'";
return;
}
-void MemRegion::printPrettyNoQuotes(raw_ostream &os) const {
- assert(canPrintPretty() && "This region cannot be printed pretty.");
+void MemRegion::printPrettyAsExpr(raw_ostream &os) const {
+ llvm_unreachable("This region cannot be printed pretty.");
return;
}
@@ -575,7 +579,7 @@ bool VarRegion::canPrintPretty() const {
return true;
}
-void VarRegion::printPrettyNoQuotes(raw_ostream &os) const {
+void VarRegion::printPrettyAsExpr(raw_ostream &os) const {
os << getDecl()->getName();
}
@@ -583,7 +587,7 @@ bool ObjCIvarRegion::canPrintPretty() const {
return true;
}
-void ObjCIvarRegion::printPrettyNoQuotes(raw_ostream &os) const {
+void ObjCIvarRegion::printPrettyAsExpr(raw_ostream &os) const {
os << getDecl()->getName();
}
@@ -591,26 +595,31 @@ bool FieldRegion::canPrintPretty() const {
return true;
}
-void FieldRegion::printPrettyNoQuotes(raw_ostream &os) const {
- if (superRegion->canPrintPretty()) {
- superRegion->printPrettyNoQuotes(os);
- os << "." << getDecl()->getName();
- } else {
- os << "field " << "\'" << getDecl()->getName() << "'";
- }
+bool FieldRegion::canPrintPrettyAsExpr() const {
+ return superRegion->canPrintPrettyAsExpr();
+}
+
+void FieldRegion::printPrettyAsExpr(raw_ostream &os) const {
+ assert(canPrintPrettyAsExpr());
+ superRegion->printPrettyAsExpr(os);
+ os << "." << getDecl()->getName();
}
void FieldRegion::printPretty(raw_ostream &os) const {
- if (superRegion->canPrintPretty()) {
+ if (canPrintPrettyAsExpr()) {
os << "\'";
- printPrettyNoQuotes(os);
+ printPrettyAsExpr(os);
os << "'";
} else {
- printPrettyNoQuotes(os);
+ os << "field " << "\'" << getDecl()->getName() << "'";
}
return;
}
+bool FieldRegion::canPrintPrettyAsExpr() const {
+ return superRegion->canPrintPrettyAsExpr();
+}
+
//===----------------------------------------------------------------------===//
// MemRegionManager methods.
//===----------------------------------------------------------------------===//