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 | f602806965531ee06fd8664b9d7a8912c4af2870 (patch) | |
tree | 66b36e40cf4f0571cd120ee1e6e9061677cc60b4 /lib/AST/APValue.cpp | |
parent | e78ec3e8f7324e36ac9cf2268d5fe32997762940 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153358 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/APValue.cpp')
-rw-r--r-- | lib/AST/APValue.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/AST/APValue.cpp b/lib/AST/APValue.cpp index 0b5b3b0a5e..a31b3c5bfb 100644 --- a/lib/AST/APValue.cpp +++ b/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()); |