[PATCH] D69770: [APFloat] Add recoverable string parsing errors to APFloat
Ehud Katz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 9 00:34:51 PST 2020
ekatz marked an inline comment as done.
ekatz added inline comments.
================
Comment at: llvm/lib/MC/MCParser/AsmParser.cpp:3133
return TokError("invalid floating point literal");
- } else if (Value.convertFromString(IDVal, APFloat::rmNearestTiesToEven) ==
- APFloat::opInvalidOp)
+ } else if (!Value.convertFromString(IDVal, APFloat::rmNearestTiesToEven))
return TokError("invalid floating point literal");
----------------
smeenai wrote:
> I'm pretty certain this won't do what you want in an asserts build (technically a build with `LLVM_ENABLE_ABI_BREAKING_CHECKS`). The destructor of an `llvm::Expected` asserts that the Expected was checked, and evaluating an Expected as a boolean only counts as checking it if there wasn't an error, in the error case, you'll hit an assert failure instead of doing the return. You'll need to capture the Expected and then do something like `consumeError(expected.takeError())` to discard the error and avoid the assertion.
I have commited a fix for this issue in rG24b326cc610d
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69770/new/
https://reviews.llvm.org/D69770
More information about the cfe-commits
mailing list