[PATCH] D109800: [clang] don't mark as Elidable CXXConstruct expressions used in NRVO

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 15 16:33:31 PDT 2021


mizvekov created this revision.
mizvekov updated this revision to Diff 372616.
mizvekov added a comment.
mizvekov updated this revision to Diff 372828.
mizvekov retitled this revision from "test commit." to "[clang] don't mark as Elidable CXXConstruct expressions used in NRVO".
mizvekov edited the summary of this revision.
Herald added a subscriber: lxfind.
mizvekov published this revision for review.
mizvekov added reviewers: rsmith, rjmccall.
mizvekov added a subscriber: Quuxplusone.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

.


mizvekov added a comment.

.


See PR51862.

The consumers of the Elidable flag in CXXConstructExpr assume that
an elidable construction just goes through a single copy/move construction,
so that the source object is immediately passed as an argument and is the same
type as the parameter itself.

With the implementation of P2266 <https://reviews.llvm.org/P2266> and after some adjustments to the
implementation of P1825 <https://reviews.llvm.org/P1825>, we started (correctly, as per standard)
allowing more cases where the copy initialization goes through
converting constructors and user defined conversions.

With this patch we stop using this flag in NRVO contexts, to preserve code
that relies on that assumption.
This causes no known functional changes, we just stop firing some asserts
in a cople of included test cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109800

Files:
  clang/include/clang/Sema/Initialization.h
  clang/lib/CodeGen/CGExprCXX.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaCoroutine.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaLambda.cpp
  clang/lib/Sema/SemaObjCProperty.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/CodeGen/nrvo-tracking.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109800.372828.patch
Type: text/x-patch
Size: 8983 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210915/616e1a6f/attachment-0001.bin>


More information about the cfe-commits mailing list