aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-04-15 22:37:53 +0000
committerAnna Zaks <ganna@apple.com>2013-04-15 22:37:53 +0000
commit82dd4396fcd2517d06382b7170f393d1b6351c7f (patch)
tree086cfb7d0dc3747373e9a234ecb433d615aa2941 /lib/StaticAnalyzer/Core
parent01218ffddc239a71951035d6c7698a11e323efe3 (diff)
[analyzer] Add more specialized error messages for corner cases as per Jordan's code review for r179396
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core')
-rw-r--r--lib/StaticAnalyzer/Core/BugReporterVisitors.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 4fbaec5d5f..18994ca0d0 100644
--- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -526,7 +526,7 @@ PathDiagnosticPiece *FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ,
"Initializing to ";
} else if (isa<BlockExpr>(S)) {
action = R->canPrintPretty() ? "captured by block as " :
- "Capturing by block as ";
+ "Captured by block as ";
if (VR) {
// See if we can get the BlockVarRegion.
ProgramStateRef State = StoreSite->getState();
@@ -580,7 +580,7 @@ PathDiagnosticPiece *FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ,
}
}
else {
- os << (R->canPrintPretty() ? "initialized" : "Initializing")
+ os << (R->canPrintPretty() ? "initialized" : "Initialized")
<< " here";
}
}
@@ -626,19 +626,33 @@ PathDiagnosticPiece *FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ,
}
}
}
+ if (!b) {
+ if (R->canPrintPretty())
+ os << "Null pointer value stored";
+ else
+ os << "Storing null pointer value";
+ }
+
+ } else if (V.isUndef()) {
+ if (R->canPrintPretty())
+ os << "Uninitialized value stored";
+ else
+ os << "Storing uninitialized value";
- if (!b)
- os << "Null pointer value stored";
- }
- else if (V.isUndef()) {
- os << "Uninitialized value stored";
} else if (Optional<nonloc::ConcreteInt> CV =
V.getAs<nonloc::ConcreteInt>()) {
- os << "The value " << CV->getValue() << " is assigned";
- }
- else
- os << "Value assigned";
+ if (R->canPrintPretty())
+ os << "The value " << CV->getValue() << " is assigned";
+ else
+ os << "Assigning " << CV->getValue();
+ } else {
+ if (R->canPrintPretty())
+ os << "Value assigned";
+ else
+ os << "Assigning value";
+ }
+
if (R->canPrintPretty()) {
os << " to ";
R->printPretty(os);