[PATCH] D49508: [Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 21 00:45:36 PDT 2018


lebedev.ri added inline comments.


================
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);
----------------
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?


Repository:
  rC Clang

https://reviews.llvm.org/D49508





More information about the cfe-commits mailing list