-
- Downloads
[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 d9308aa3)
Showing
- clang/include/clang/Sema/Initialization.h 8 additions, 8 deletionsclang/include/clang/Sema/Initialization.h
- clang/lib/AST/ExprConstant.cpp 12 additions, 3 deletionsclang/lib/AST/ExprConstant.cpp
- clang/lib/CodeGen/CGExprCXX.cpp 11 additions, 8 deletionsclang/lib/CodeGen/CGExprCXX.cpp
- clang/lib/Sema/Sema.cpp 1 addition, 1 deletionclang/lib/Sema/Sema.cpp
- clang/lib/Sema/SemaCoroutine.cpp 1 addition, 1 deletionclang/lib/Sema/SemaCoroutine.cpp
- clang/lib/Sema/SemaDeclCXX.cpp 9 additions, 0 deletionsclang/lib/Sema/SemaDeclCXX.cpp
- clang/lib/Sema/SemaExpr.cpp 1 addition, 1 deletionclang/lib/Sema/SemaExpr.cpp
- clang/lib/Sema/SemaExprCXX.cpp 2 additions, 3 deletionsclang/lib/Sema/SemaExprCXX.cpp
- clang/lib/Sema/SemaLambda.cpp 1 addition, 2 deletionsclang/lib/Sema/SemaLambda.cpp
- clang/lib/Sema/SemaObjCProperty.cpp 1 addition, 2 deletionsclang/lib/Sema/SemaObjCProperty.cpp
- clang/lib/Sema/SemaStmt.cpp 4 additions, 4 deletionsclang/lib/Sema/SemaStmt.cpp
- clang/test/CodeGen/nrvo-tracking.cpp 37 additions, 0 deletionsclang/test/CodeGen/nrvo-tracking.cpp
- clang/test/CodeGenCXX/copy-elision.cpp 34 additions, 0 deletionsclang/test/CodeGenCXX/copy-elision.cpp
Loading
Please register or sign in to comment