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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 13:28:46 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: rsmith, rjmccall, majnemer, efriedma.
Herald added a subscriber: cfe-commits.

As discussed in PR38166 <https://bugs.llvm.org/show_bug.cgi?id=38166>, we need to be able to distinqush whether the cast
we are visiting is actually a cast, or part of an `ExplicitCast`.
There are at least two ways to get there:

1. Introduce a new `CastKind`, and use it instead of `IntegralCast` if we are in `ExplicitCast`.

  Would work, but does not scale - what if we will need more of these cast kinds?
2. Fix `ScalarExprEmitter::VisitCastExpr()` to visit these `NoOp` casts.

  As pointed out by @rsmith, CodeGenFunction::EmitMaterializeTemporaryExpr calls

  skipRValueSubobjectAdjustments, which steps over the CK_NoOp cast`,

  which explains why we currently don't visit those.

Now, the problem is, this is a very specific area of clang.
I'm not familiar with it.
At first, when i saw these test regressions, i immediately panicked,
But now that i have actually looked at them in detail, at least in the case of `test/CodeGenCXX/cxx0x-initializer-*`,
as far as i can tell, only the IR is different, the assembly is still exactly the same. Or i'm really failing to look..
So i'm not sure whether these test changes are really ok or not, thus i'm posting this differential.


Repository:
  rC Clang

https://reviews.llvm.org/D49508

Files:
  include/clang/AST/Expr.h
  lib/AST/Expr.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprConstant.cpp
  test/CodeGenCXX/const-init-cxx11.cpp
  test/CodeGenCXX/cxx0x-initializer-references.cpp
  test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49508.156137.patch
Type: text/x-patch
Size: 4976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/e14e7a1f/attachment.bin>


More information about the llvm-commits mailing list