diff options
author | Ehud Katz <ehudkatz@gmail.com> | 2020-01-06 10:05:00 +0200 |
---|---|---|
committer | Ehud Katz <ehudkatz@gmail.com> | 2020-01-06 10:09:01 +0200 |
commit | c5fb73c5d1b3f1adb77d99fc85c594b48bff08f9 (patch) | |
tree | 89df48258530ece7f2d2f32a3c5d31bc433013b1 /clang/lib/Lex/LiteralSupport.cpp | |
parent | a7929533300535547f8484f7e38765234a7e7c93 (diff) | |
download | bcm5719-llvm-c5fb73c5d1b3f1adb77d99fc85c594b48bff08f9.tar.gz bcm5719-llvm-c5fb73c5d1b3f1adb77d99fc85c594b48bff08f9.zip |
[APFloat] Add recoverable string parsing errors to APFloat
Implementing the APFloat part in PR4745.
Differential Revision: https://reviews.llvm.org/D69770
Diffstat (limited to 'clang/lib/Lex/LiteralSupport.cpp')
-rw-r--r-- | clang/lib/Lex/LiteralSupport.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index 2108408377f..66309183a14 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -1051,7 +1051,10 @@ NumericLiteralParser::GetFloatValue(llvm::APFloat &Result) { Str = Buffer; } - return Result.convertFromString(Str, APFloat::rmNearestTiesToEven); + auto StatusOrErr = + Result.convertFromString(Str, APFloat::rmNearestTiesToEven); + assert(StatusOrErr && "Invalid floating point representation"); + return StatusOrErr ? *StatusOrErr : APFloat::opInvalidOp; } static inline bool IsExponentPart(char c) { |