[PATCH] D49508: [CodeGen] VisitMaterializeTemporaryExpr(): don't skip NoOp Casts.

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 23:32:58 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D49508#1167177, @efriedma wrote:

> skipRValueSubobjectAdjustments has to match the rules in `[class.temporary]` in the standard, which includes skipping over certain explicit casts.


I'm this approach because this is what @rsmith suggested. As i said, i don't really know this code,
so maybe i'm missing something obvious that makes this still possible.

> Would it be enough to accumulate the skipped casts into a SmallVector, like we do for the skipped comma operators?

Hmm, I'm not sure. It depends whether we return from `CodeGenFunction::EmitMaterializeTemporaryExpr()`,
or are still within the  `CodeGenFunction::EmitMaterializeTemporaryExpr()` function, when visiting nested nodes.
This might work, but let's see if i can make the flag approach work.

In https://reviews.llvm.org/D49508#1167566, @rjmccall wrote:

> I think it would be reasonable to set a flag on `ImplicitCastExpr`s that are actually semantically part of an explicit cast.  I don't think that would be hard to get Sema to do, either by passing a flag down to the code that builds those casts or just by retroactively setting that flag on all the ICE sub-expressions of an explicit cast when "capping" it with the `ExplicitCastExpr`.


That was my initial thought, too.
I wasn't sure how to approach this though.


Repository:
  rC Clang

https://reviews.llvm.org/D49508





More information about the cfe-commits mailing list