From 2098ad7f00324ee0f2a6538f418a6f81dfdd2edb Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 17 Dec 2022 04:11:55 +0000 Subject: [PATCH] [flang] std::optional::value => operator*/operator-> --- flang/include/flang/Evaluate/tools.h | 5 ++--- flang/lib/Semantics/check-omp-structure.cpp | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/flang/include/flang/Evaluate/tools.h b/flang/include/flang/Evaluate/tools.h index bedc5c4..3bed3e2 100644 --- a/flang/include/flang/Evaluate/tools.h +++ b/flang/include/flang/Evaluate/tools.h @@ -583,9 +583,8 @@ template struct ConvertToKindHelper { template common::IfNoLvalue>, VALUE> ConvertToKind( int kind, VALUE &&x) { - return common::SearchTypes( - ConvertToKindHelper{kind, std::move(x)}) - .value(); + return *common::SearchTypes( + ConvertToKindHelper{kind, std::move(x)}); } // Given a type category CAT, SameKindExprs is a variant that diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 883515c..ada5d92 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -334,9 +334,9 @@ void OmpStructureChecker::CheckHintClause( hintClause{ std::get_if(&ompClause->u)}) { std::optional hintValue = GetIntValue(hintClause->v); - if (hintValue && hintValue.value() >= 0) { - if((hintValue.value() & 0xC) == 0xC /*`omp_sync_hint_nonspeculative` and `omp_lock_hint_speculative`*/ - || (hintValue.value() & 0x3) == 0x3 /*`omp_sync_hint_uncontended` and omp_sync_hint_contended*/ ) + if (hintValue && *hintValue >= 0) { + if((*hintValue & 0xC) == 0xC /*`omp_sync_hint_nonspeculative` and `omp_lock_hint_speculative`*/ + || (*hintValue & 0x3) == 0x3 /*`omp_sync_hint_uncontended` and omp_sync_hint_contended*/ ) context_.Say(clause.source, "Hint clause value " "is not a valid OpenMP synchronization value"_err_en_US); -- 2.7.4