summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/APValue.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-23 23:55:39 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-23 23:55:39 +0000
commit5614ca77153b254f9ab756d4a41c4a55ed9dda46 (patch)
treee0d9180eac3c671ae5723fd7a546b8f3af731597 /clang/lib/AST/APValue.cpp
parentd18cb502bdfcf76ea0f5b45014ccf7df030a7829 (diff)
downloadbcm5719-llvm-5614ca77153b254f9ab756d4a41c4a55ed9dda46.tar.gz
bcm5719-llvm-5614ca77153b254f9ab756d4a41c4a55ed9dda46.zip
Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix up
some calling code to actually pass in a non-null type, to avoid a crash. llvm-svn: 153358
Diffstat (limited to 'clang/lib/AST/APValue.cpp')
-rw-r--r--clang/lib/AST/APValue.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 0b5b3b0a5e5..a31b3c5bfb3 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -312,7 +312,10 @@ void APValue::printPretty(raw_ostream &Out, ASTContext &Ctx, QualType Ty) const{
Out << "<uninitialized>";
return;
case APValue::Int:
- Out << getInt();
+ if (Ty->isBooleanType())
+ Out << (getInt().getBoolValue() ? "true" : "false");
+ else
+ Out << getInt();
return;
case APValue::Float:
Out << GetApproxValue(getFloat());
OpenPOWER on IntegriCloud