Implementing the APFloat part in PR4745.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
If we really want to be confident that this is robust, we should probably fuzz-test it. Regardless, this seems like a definite improvement. LGTM.
llvm/lib/Support/StringRef.cpp | ||
---|---|---|
593 | This is an invalid assert. lib/Support/StringRef.cpp:593:12: warning: implicit conversion turns string literal into bool: 'const char [38]' to 'bool' [-Wstring-conversion] |
llvm/lib/MC/MCParser/AsmParser.cpp | ||
---|---|---|
3133 | 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. |
llvm/lib/MC/MCParser/AsmParser.cpp | ||
---|---|---|
3133 | I have commited a fix for this issue in rG24b326cc610d |
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.