[clang] [llvm] [OpenMP][OMPIRBuilder] Handle non-failing calls properly (PR #115863)
Michael Kruse via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 16:26:10 PST 2024
================
@@ -235,10 +235,9 @@ class OpenMPIRBuilderTest : public testing::Test {
return Error::success();
};
- Expected<CanonicalLoopInfo *> LoopResult =
- OMPBuilder.createCanonicalLoop(Loc, LoopBodyGenCB, CastedTripCount);
- assert(LoopResult && "unexpected error");
- CanonicalLoopInfo *Loop = *LoopResult;
+
+ CanonicalLoopInfo *Loop = *expectedToOptional(
----------------
Meinersbur wrote:
Derefencting a `std::nullopt` is undefined behaviour, so potentially the same as `cantFail`.
The comment of `expectedToOptional` indicated that it is discurraged to use it.
https://github.com/llvm/llvm-project/pull/115863
More information about the cfe-commits
mailing list