[clang] 3ec6c72 - [AST] Fix -Wlogical-op-parentheses in ExprConstant.cpp (NFC)

Jie Fu via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 9 03:14:52 PST 2023


Author: Jie Fu
Date: 2023-12-09T19:13:30+08:00
New Revision: 3ec6c72551846b8f4143c8c101a1a6203e85a2aa

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

LOG: [AST] Fix -Wlogical-op-parentheses in ExprConstant.cpp (NFC)

llvm-project/clang/lib/AST/ExprConstant.cpp:5645:74: error: '&&' within '||' [-Werror,-Wlogical-op-parentheses]
 5645 |       (Definition->isConstexpr() || Info.CurrentCall->CanEvalMSConstexpr &&
      |                                  ~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 5646 |                                         Definition->hasAttr<MSConstexprAttr>()))
      |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
llvm-project/clang/lib/AST/ExprConstant.cpp:5645:74: note: place parentheses around the '&&' expression to silence this warning
 5645 |       (Definition->isConstexpr() || Info.CurrentCall->CanEvalMSConstexpr &&
      |                                                                          ^
      |                                     (
 5646 |                                         Definition->hasAttr<MSConstexprAttr>()))
      |
      |                                                                               )
1 error generated.

Added: 
    

Modified: 
    clang/lib/AST/ExprConstant.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 9bef70770a544..f035c1419f4c9 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -5642,8 +5642,8 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
 
   // Can we evaluate this function call?
   if (Definition && Body &&
-      (Definition->isConstexpr() || Info.CurrentCall->CanEvalMSConstexpr &&
-                                        Definition->hasAttr<MSConstexprAttr>()))
+      (Definition->isConstexpr() || (Info.CurrentCall->CanEvalMSConstexpr &&
+                                        Definition->hasAttr<MSConstexprAttr>())))
     return true;
 
   if (Info.getLangOpts().CPlusPlus11) {


        


More information about the cfe-commits mailing list