[PATCH] D138289: [clang][Parse] Remove constant expression from if condition

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 05:17:36 PST 2022


tbaeder created this revision.
tbaeder added a reviewer: clang.
Herald added a project: All.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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

I'm just not sure if this should be using `isTypeCast` instead or not. Let's see what the CI says.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138289

Files:
  clang/lib/Parse/ParseExpr.cpp


Index: clang/lib/Parse/ParseExpr.cpp
===================================================================
--- clang/lib/Parse/ParseExpr.cpp
+++ clang/lib/Parse/ParseExpr.cpp
@@ -3168,7 +3168,7 @@
     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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138289.476435.patch
Type: text/x-patch
Size: 614 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221118/750b6049/attachment-0001.bin>


More information about the cfe-commits mailing list