[flang-commits] [flang] 2098ad7 - [flang] std::optional::value => operator*/operator->
Fangrui Song via flang-commits
flang-commits at lists.llvm.org
Fri Dec 16 20:12:01 PST 2022
Author: Fangrui Song
Date: 2022-12-17T04:11:55Z
New Revision: 2098ad7f00324ee0f2a6538f418a6f81dfdd2edb
URL: https://github.com/llvm/llvm-project/commit/2098ad7f00324ee0f2a6538f418a6f81dfdd2edb
DIFF: https://github.com/llvm/llvm-project/commit/2098ad7f00324ee0f2a6538f418a6f81dfdd2edb.diff
LOG: [flang] std::optional::value => operator*/operator->
Added:
Modified:
flang/include/flang/Evaluate/tools.h
flang/lib/Semantics/check-omp-structure.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Evaluate/tools.h b/flang/include/flang/Evaluate/tools.h
index bedc5c453bc8d..3bed3e2408705 100644
--- a/flang/include/flang/Evaluate/tools.h
+++ b/flang/include/flang/Evaluate/tools.h
@@ -583,9 +583,8 @@ template <TypeCategory TOCAT, typename VALUE> struct ConvertToKindHelper {
template <TypeCategory TOCAT, typename VALUE>
common::IfNoLvalue<Expr<SomeKind<TOCAT>>, VALUE> ConvertToKind(
int kind, VALUE &&x) {
- return common::SearchTypes(
- ConvertToKindHelper<TOCAT, VALUE>{kind, std::move(x)})
- .value();
+ return *common::SearchTypes(
+ ConvertToKindHelper<TOCAT, VALUE>{kind, std::move(x)});
}
// Given a type category CAT, SameKindExprs<CAT, N> is a variant that
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 883515c16d4ad..ada5d9257fb5a 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<Fortran::parser::OmpClause::Hint>(&ompClause->u)}) {
std::optional<std::int64_t> 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);
More information about the flang-commits
mailing list