[clang] [llvm] [OpenMP][OMPIRBuilder] Handle non-failing calls properly (PR #115863)
Sergio Afonso via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 15 04:59:19 PST 2024
================
@@ -345,18 +344,15 @@ TEST_F(OpenMPIRBuilderTest, CreateBarrier) {
IRBuilder<> Builder(BB);
- OpenMPIRBuilder::InsertPointOrErrorTy BarrierIP1 =
- OMPBuilder.createBarrier({IRBuilder<>::InsertPoint()}, OMPD_for);
- assert(BarrierIP1 && "unexpected error");
+ ASSERT_TRUE(expectedToOptional(
+ OMPBuilder.createBarrier({IRBuilder<>::InsertPoint()}, OMPD_for)));
----------------
skatrak wrote:
I made another revision to avoid translating to `std::optional` in order to discard errors, and instead handle them through some new local macros. I'm not against adding these functions that you propose, but that doesn't seem like a good thing to do as part of this PR. Perhaps something that can be added separately and then potentially update this and other tests to use it.
https://github.com/llvm/llvm-project/pull/115863
More information about the cfe-commits
mailing list