[flang-commits] [flang] b47dac6 - [flang][OpenMP] Remove pessimizing move introduced in 90f45a15ab

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Fri Mar 7 06:38:44 PST 2025


Author: Krzysztof Parzyszek
Date: 2025-03-07T08:38:15-06:00
New Revision: b47dac609bbd7697db5287f628b431dac661dc23

URL: https://github.com/llvm/llvm-project/commit/b47dac609bbd7697db5287f628b431dac661dc23
DIFF: https://github.com/llvm/llvm-project/commit/b47dac609bbd7697db5287f628b431dac661dc23.diff

LOG: [flang][OpenMP] Remove pessimizing move introduced in 90f45a15ab

This unbreaks the builders that diagnose this situation:

  error: moving a temporary object prevents copy elision [-Werror,-Wpess
imizing-move]
    341 |   static OmpClauseList empty{std::move(decltype(OmpClauseList:
:v){})};
        |                              ^

Added: 
    

Modified: 
    flang/lib/Parser/parse-tree.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/parse-tree.cpp b/flang/lib/Parser/parse-tree.cpp
index 95575e76c1149..5917f30b3c589 100644
--- a/flang/lib/Parser/parse-tree.cpp
+++ b/flang/lib/Parser/parse-tree.cpp
@@ -338,7 +338,7 @@ llvm::omp::Clause OmpClause::Id() const {
 }
 
 const OmpClauseList &OmpDirectiveSpecification::Clauses() const {
-  static OmpClauseList empty{std::move(decltype(OmpClauseList::v){})};
+  static OmpClauseList empty{decltype(OmpClauseList::v){}};
   if (auto &clauses = std::get<std::optional<OmpClauseList>>(t)) {
     return *clauses;
   }


        


More information about the flang-commits mailing list