[all-commits] [llvm/llvm-project] d7b669: [clang] don't mark as Elidable CXXConstruct expres...

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Fri Sep 24 09:18:41 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: d7b669b3a30345cfcdb2fde2af6f48aa4b94845d
      https://github.com/llvm/llvm-project/commit/d7b669b3a30345cfcdb2fde2af6f48aa4b94845d
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2021-09-24 (Fri, 24 Sep 2021)

  Changed paths:
    M clang/include/clang/Sema/Initialization.h
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/CodeGen/CGExprCXX.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaCoroutine.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaLambda.cpp
    M clang/lib/Sema/SemaObjCProperty.cpp
    M clang/lib/Sema/SemaStmt.cpp
    M clang/test/CodeGen/nrvo-tracking.cpp
    A clang/test/CodeGenCXX/copy-elision.cpp

  Log Message:
  -----------
  [clang] don't mark as Elidable CXXConstruct expressions used in NRVO

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 and after some adjustments to the
implementation of P1825, we started (correctly, as per standard)
allowing more cases where the copy initialization goes through
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.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D109800

(cherry picked from commit d9308aa39b236064a680ca57178af3c731e13e49)




More information about the All-commits mailing list