diff options
author | Leonard Chan <leonardchan@google.com> | 2018-08-06 16:05:08 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2018-08-06 16:05:08 +0000 |
commit | c03642e9a86d9ed128676d5405a1906282d727ad (patch) | |
tree | c221a392e0bf810a25b78cc0f46c89c8525c0c48 /clang/lib/AST/ExprConstant.cpp | |
parent | 0d1b3934e27f72f706345678204a87f72007ed64 (diff) | |
download | bcm5719-llvm-c03642e9a86d9ed128676d5405a1906282d727ad.tar.gz bcm5719-llvm-c03642e9a86d9ed128676d5405a1906282d727ad.zip |
[Fixed Point Arithmetic] Fix for FixedPointValueToString
- Print negative numbers correctly
- Handle APInts of different sizes
- Add formal unit tests for FixedPointValueToString
- Add tests for checking correct printing when padding is set
- Restrict to printing in radix 10 since that's all we need for now
Differential Revision: https://reviews.llvm.org/D49945
llvm-svn: 339026
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 222ff74aaac..7e596d0715c 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -9698,8 +9698,7 @@ bool FixedPointExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) { if (Value.isSigned() && Value.isMinSignedValue() && E->canOverflow()) { SmallString<64> S; FixedPointValueToString(S, Value, - Info.Ctx.getTypeInfo(E->getType()).Width, - /*Radix=*/10); + Info.Ctx.getTypeInfo(E->getType()).Width); Info.CCEDiag(E, diag::note_constexpr_overflow) << S << E->getType(); if (Info.noteUndefinedBehavior()) return false; } |