[flang-commits] [flang] b0764e0 - [flang] Recode a line to dodge a clang warning

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Sat Oct 29 16:02:13 PDT 2022


Author: Peter Klausler
Date: 2022-10-29T16:02:00-07:00
New Revision: b0764e0b2d8d129f73b2946c062150f1362ebb88

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

LOG: [flang] Recode a line to dodge a clang warning

Rewrite a correct use of "&" -- conjunction without short-circuiting --
from a recent patch into multiple lines so that clang doesn't warn
about it.

Added: 
    

Modified: 
    flang/lib/Semantics/expression.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index 6fa48277d013..603fb87d0950 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -356,8 +356,10 @@ bool ExpressionAnalyzer::CheckPolymorphic(const DataRef &dataRef) {
 }
 
 bool ExpressionAnalyzer::CheckDataRef(const DataRef &dataRef) {
-  // '&' here prevents short-circuiting
-  return CheckRanks(dataRef) & CheckPolymorphic(dataRef);
+  // Always check both, don't short-circuit
+  bool ranksOk{CheckRanks(dataRef)};
+  bool polyOk{CheckPolymorphic(dataRef)};
+  return ranksOk && polyOk;
 }
 
 // Parse tree correction after a substring S(j:k) was misparsed as an


        


More information about the flang-commits mailing list