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

Matheus Izvekov via All-commits all-commits at lists.llvm.org
Tue Sep 21 12:41:36 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9308aa39b236064a680ca57178af3c731e13e49
      https://github.com/llvm/llvm-project/commit/d9308aa39b236064a680ca57178af3c731e13e49
  Author: Matheus Izvekov <mizvekov at gmail.com>
  Date:   2021-09-21 (Tue, 21 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




More information about the All-commits mailing list