[PATCH] D49838: [AST] Sink 'part of explicit cast' down into ImplicitCastExpr

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 26 06:06:56 PDT 2018


erichkeane added a comment.

2 small items, otherwise looks good.



================
Comment at: include/clang/AST/Expr.h:2824
     CastExprBits.Kind = kind;
-    CastExprBits.PartOfExplicitCast = false;
     setBasePathSize(BasePathSize);
----------------
So, I'd prefer that this line get left in.  Removing this makes it the single unused item in CastExprBitfields, so leaving it uninitialized is likely a bad idea.  


================
Comment at: lib/Sema/SemaCast.cpp:97
       while ((CE = dyn_cast<ImplicitCastExpr>(CE->getSubExpr())))
-        CE->setIsPartOfExplicitCast(true);
+        dyn_cast<ImplicitCastExpr>(CE)->setIsPartOfExplicitCast(true);
     }
----------------
I think I'd prefer just using a different variable in the 'while' loop to avoid the cast.  something like while((auto ICE =....

That said, either way this isn't a dyn_cast, this would be just a cast (since we KNOW the type).


Repository:
  rC Clang

https://reviews.llvm.org/D49838





More information about the cfe-commits mailing list