rsmith accepted this revision. rsmith added inline comments. This revision is now accepted and ready to land.
================ Comment at: lib/Sema/SemaCast.cpp:94-101 + void updatePartOfExplicitCastFlags(CastExpr *CE) { + // Walk down from the CE to the OrigSrcExpr, and mark all immediate + // ImplicitCastExpr's as being part of ExplicitCastExpr. The original CE + // (which is a ExplicitCastExpr), and the OrigSrcExpr are not touched. + while (OrigSrcExpr.get() != CE->getSubExpr() && + (CE = dyn_cast<ImplicitCastExpr>(CE->getSubExpr()))) + CE->setIsPartOfExplicitCast(true); ---------------- lebedev.ri wrote: > rsmith wrote: > > You don't need to track the `OrigSrcExpr` here. You can just recurse down > > through all the `ImplicitCastExpr`s (they're always all notionally part of > > the explicit cast). > We do sometimes have `OrigSrcExpr` being `ImplicitCastExpr`. > https://godbolt.org/g/S5951G <- that `ImplicitCastExpr` would now get marked, > even though it is `OrigSrcExpr`. > Is that expected? Yes, that's expected, the conversion from `int` to `char` there is part of the semantics of the explicit cast from `int` to `vector of char`, and you wouldn't want your UBSan check to warn about that, right? Repository: rC Clang https://reviews.llvm.org/D49508 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits