[flang-commits] [flang] 7aa77c5 - [flang] Fix a warning

Kazu Hirata via flang-commits flang-commits at lists.llvm.org
Fri Jul 22 17:56:18 PDT 2022


Author: Kazu Hirata
Date: 2022-07-22T17:56:10-07:00
New Revision: 7aa77c5a6712a81116d232f789a1fdf36252cad0

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

LOG: [flang] Fix a warning

This patch fixes:

  llvm-project/flang/lib/Semantics/expression.cpp:405:12: error:
  moving a local object in a return statement prevents copy elision
  [-Werror,-Wpessimizing-move]

Added: 
    

Modified: 
    flang/lib/Semantics/expression.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index d8b3f5e32c28..d4492d2f3e99 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -402,7 +402,7 @@ MaybeExpr ExpressionAnalyzer::FixMisparsedSubstring(
 MaybeExpr ExpressionAnalyzer::Analyze(const parser::Designator &d) {
   auto restorer{GetContextualMessages().SetLocation(d.source)};
   if (auto substringInquiry{FixMisparsedSubstring(d)}) {
-    return std::move(substringInquiry);
+    return substringInquiry;
   }
   // These checks have to be deferred to these "top level" data-refs where
   // we can be sure that there are no following subscripts (yet).


        


More information about the flang-commits mailing list