diff options
author | Anna Zaks <ganna@apple.com> | 2013-04-12 18:40:21 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-04-12 18:40:21 +0000 |
commit | 9e2f5977a180ae927d05e844c65b8a7873be48a4 (patch) | |
tree | 96fa8bd1b0f074f3870cbe140c2c9a9e8a23b528 /lib/StaticAnalyzer/Core/MemRegion.cpp | |
parent | 333ac6ed908bd70b879243a1d8541c27f142b40a (diff) |
[analyzer]Print field region even when the base region is not printable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/MemRegion.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/MemRegion.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/lib/StaticAnalyzer/Core/MemRegion.cpp b/lib/StaticAnalyzer/Core/MemRegion.cpp index b3a1e65b19..e244d31afa 100644 --- a/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -559,6 +559,15 @@ bool MemRegion::canPrintPretty() const { } void MemRegion::printPretty(raw_ostream &os) const { + assert(canPrintPretty() && "This region cannot be printed pretty."); + os << "'"; + printPrettyNoQuotes(os); + os << "'"; + return; +} + +void MemRegion::printPrettyNoQuotes(raw_ostream &os) const { + assert(canPrintPretty() && "This region cannot be printed pretty."); return; } @@ -566,7 +575,7 @@ bool VarRegion::canPrintPretty() const { return true; } -void VarRegion::printPretty(raw_ostream &os) const { +void VarRegion::printPrettyNoQuotes(raw_ostream &os) const { os << getDecl()->getName(); } @@ -574,17 +583,32 @@ bool ObjCIvarRegion::canPrintPretty() const { return true; } -void ObjCIvarRegion::printPretty(raw_ostream &os) const { +void ObjCIvarRegion::printPrettyNoQuotes(raw_ostream &os) const { os << getDecl()->getName(); } bool FieldRegion::canPrintPretty() const { - return superRegion->canPrintPretty(); + return true; +} + +void FieldRegion::printPrettyNoQuotes(raw_ostream &os) const { + if (superRegion->canPrintPretty()) { + superRegion->printPrettyNoQuotes(os); + os << "." << getDecl()->getName(); + } else { + os << "field " << "\'" << getDecl()->getName() << "'"; + } } void FieldRegion::printPretty(raw_ostream &os) const { - superRegion->printPretty(os); - os << "." << getDecl()->getName(); + if (superRegion->canPrintPretty()) { + os << "\'"; + printPrettyNoQuotes(os); + os << "'"; + } else { + printPrettyNoQuotes(os); + } + return; } //===----------------------------------------------------------------------===// |