Index: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===================================================================
--- lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -2306,10 +2306,17 @@
if (!IsAssuming)
IntValue = getConcreteIntegerValue(CondVarExpr, N);
- if (IsAssuming || !IntValue.hasValue())
- Out << (TookTrue ? "not equal to 0" : "0");
- else
- Out << *IntValue.getValue();
+ if (IsAssuming || !IntValue.hasValue()) {
+ if (Ty->isBooleanType())
+ Out << (TookTrue ? "true" : "false");
+ else
+ Out << (TookTrue ? "not equal to 0" : "0");
+ } else {
+ if (Ty->isBooleanType())
+ Out << (IntValue.getValue()->getBoolValue() ? "true" : "false");
+ else
+ Out << *IntValue.getValue();
+ }
return true;
}
Index: test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist
===================================================================
--- test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist
+++ test/Analysis/Inputs/expected-plists/cxx-for-range.cpp.plist
@@ -832,9 +832,9 @@
depth1
extended_message
- 'fail' is 1
+ 'fail' is true
message
- 'fail' is 1
+ 'fail' is true
kindcontrol
Index: test/Analysis/diagnostics/no-store-func-path-notes.cpp
===================================================================
--- test/Analysis/diagnostics/no-store-func-path-notes.cpp
+++ test/Analysis/diagnostics/no-store-func-path-notes.cpp
@@ -102,7 +102,7 @@
C(int pX, int pY, bool Flag) {
x = pX;
- if (Flag) // expected-note{{Assuming 'Flag' is not equal to 0}}
+ if (Flag) // expected-note{{Assuming 'Flag' is true}}
// expected-note@-1{{Taking true branch}}
return; // expected-note{{Returning without writing to 'this->y'}}
y = pY;
Index: test/Analysis/inner-pointer.cpp
===================================================================
--- test/Analysis/inner-pointer.cpp
+++ test/Analysis/inner-pointer.cpp
@@ -38,9 +38,9 @@
std::string s;
const char *c2 = s.c_str();
if (cond) {
- // expected-note@-1 {{Assuming 'cond' is not equal to 0}}
+ // expected-note@-1 {{Assuming 'cond' is true}}
// expected-note@-2 {{Taking true branch}}
- // expected-note@-3 {{Assuming 'cond' is 0}}
+ // expected-note@-3 {{Assuming 'cond' is false}}
// expected-note@-4 {{Taking false branch}}
consume(c); // expected-warning {{Inner pointer of container used after re/deallocation}}
// expected-note@-1 {{Inner pointer of container used after re/deallocation}}
@@ -73,9 +73,9 @@
std::wstring s;
const wchar_t *c2 = s.c_str();
if (cond) {
- // expected-note@-1 {{Assuming 'cond' is not equal to 0}}
+ // expected-note@-1 {{Assuming 'cond' is true}}
// expected-note@-2 {{Taking true branch}}
- // expected-note@-3 {{Assuming 'cond' is 0}}
+ // expected-note@-3 {{Assuming 'cond' is false}}
// expected-note@-4 {{Taking false branch}}
consume(c); // expected-warning {{Inner pointer of container used after re/deallocation}}
// expected-note@-1 {{Inner pointer of container used after re/deallocation}}
@@ -122,9 +122,9 @@
std::string s2;
const char *c2 = s2.c_str();
if (cond) {
- // expected-note@-1 {{Assuming 'cond' is not equal to 0}}
+ // expected-note@-1 {{Assuming 'cond' is true}}
// expected-note@-2 {{Taking true branch}}
- // expected-note@-3 {{Assuming 'cond' is 0}}
+ // expected-note@-3 {{Assuming 'cond' is false}}
// expected-note@-4 {{Taking false branch}}
consume(c1); // expected-warning {{Inner pointer of container used after re/deallocation}}
// expected-note@-1 {{Inner pointer of container used after re/deallocation}}
Index: test/Analysis/use-after-move.cpp
===================================================================
--- test/Analysis/use-after-move.cpp
+++ test/Analysis/use-after-move.cpp
@@ -462,7 +462,7 @@
a.foo();
#ifndef PEACEFUL
// expected-note@-5 {{Object 'a' is moved}}
- // expected-note@-4 {{Assuming 'cond' is not equal to 0}}
+ // expected-note@-4 {{Assuming 'cond' is true}}
// expected-note@-5 {{Taking true branch}}
// expected-warning@-5 {{Method called on moved-from object 'a'}}
// expected-note@-6 {{Method called on moved-from object 'a'}}