[clang] 2a1c192 - [clang][Parse] Remove constant expression from if condition

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 22 08:31:37 PST 2022


Author: Timm Bäder
Date: 2022-11-22T17:31:21+01:00
New Revision: 2a1c192bd6bf639bc3f14cfb19c5d7aff5e7794b

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

LOG: [clang][Parse] Remove constant expression from if condition

MaybeTypeCast here is not a variable, it's an enum member with value 1.

Differential Revision: https://reviews.llvm.org/D138289

Added: 
    

Modified: 
    clang/lib/Parse/ParseExpr.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 20ce560514e94..9ac8706191d3a 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -3168,7 +3168,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
     InMessageExpressionRAIIObject InMessage(*this, false);
 
     Result = ParseExpression(MaybeTypeCast);
-    if (!getLangOpts().CPlusPlus && MaybeTypeCast && Result.isUsable()) {
+    if (!getLangOpts().CPlusPlus && Result.isUsable()) {
       // Correct typos in non-C++ code earlier so that implicit-cast-like
       // expressions are parsed correctly.
       Result = Actions.CorrectDelayedTyposInExpr(Result);


        


More information about the cfe-commits mailing list