diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-23 23:55:39 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-23 23:55:39 +0000 |
commit | 5614ca77153b254f9ab756d4a41c4a55ed9dda46 (patch) | |
tree | e0d9180eac3c671ae5723fd7a546b8f3af731597 /clang/lib/AST/APValue.cpp | |
parent | d18cb502bdfcf76ea0f5b45014ccf7df030a7829 (diff) | |
download | bcm5719-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.cpp | 5 |
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()); |