[PATCH] D49838: [AST] Sink 'part of explicit cast' down into ImplicitCastExpr
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 26 07:36:35 PDT 2018
lebedev.ri added inline comments.
================
Comment at: lib/Sema/SemaCast.cpp:97
while ((CE = dyn_cast<ImplicitCastExpr>(CE->getSubExpr())))
- CE->setIsPartOfExplicitCast(true);
+ dyn_cast<ImplicitCastExpr>(CE)->setIsPartOfExplicitCast(true);
}
----------------
lebedev.ri wrote:
> erichkeane wrote:
> > 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).
> I was trying to avoid having one extra variable, which may confuse things.
> Let's see maybe it's not that ugly..
Indeed, `cast<>` should be used.
But trying to avoid this cast at all results in uglier code, so let's not.
(I need to call `getSubExpr()` on this new `ImplicitCastExpr`, so i'd need to maintain two variables, etc...)
Repository:
rC Clang
https://reviews.llvm.org/D49838
More information about the cfe-commits
mailing list