summaryrefslogtreecommitdiffstats
path: root/clang/include/clang/Sema/Initialization.h
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-04-06 12:53:43 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-04-06 12:53:43 +0000
commitb4791c7595eb1637c6371b1ec30756631c2c7f32 (patch)
treefa11b0602ee05827d7a53c2ec57cbf0b4f7418e4 /clang/include/clang/Sema/Initialization.h
parente228f68811ffe816faaa892b27dafb788393aba8 (diff)
downloadbcm5719-llvm-b4791c7595eb1637c6371b1ec30756631c2c7f32.tar.gz
bcm5719-llvm-b4791c7595eb1637c6371b1ec30756631c2c7f32.zip
Fix lambda to block conversion in C++17 by avoiding copy elision for the
lambda capture used by the created block The commit r288866 introduced guaranteed copy elision to C++ 17. This unfortunately broke the lambda to block conversion in C++17 (the compiler crashes when performing IRGen). This commit fixes the conversion by avoiding copy elision for the capture that captures the lambda that's used in the block created by the lambda to block conversion process. rdar://31385153 Differential Revision: https://reviews.llvm.org/D31669 llvm-svn: 299646
Diffstat (limited to 'clang/include/clang/Sema/Initialization.h')
-rw-r--r--clang/include/clang/Sema/Initialization.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/include/clang/Sema/Initialization.h b/clang/include/clang/Sema/Initialization.h
index c16b3d34eab..bd07b9ea9ae 100644
--- a/clang/include/clang/Sema/Initialization.h
+++ b/clang/include/clang/Sema/Initialization.h
@@ -70,6 +70,9 @@ public:
/// \brief The entity being initialized is a field of block descriptor for
/// the copied-in c++ object.
EK_BlockElement,
+ /// The entity being initialized is a field of block descriptor for the
+ /// copied-in lambda object that's used in the lambda to block conversion.
+ EK_LambdaToBlockConversionBlockElement,
/// \brief The entity being initialized is the real or imaginary part of a
/// complex number.
EK_ComplexElement,
@@ -260,7 +263,13 @@ public:
QualType Type, bool NRVO) {
return InitializedEntity(EK_BlockElement, BlockVarLoc, Type, NRVO);
}
-
+
+ static InitializedEntity InitializeLambdaToBlock(SourceLocation BlockVarLoc,
+ QualType Type, bool NRVO) {
+ return InitializedEntity(EK_LambdaToBlockConversionBlockElement,
+ BlockVarLoc, Type, NRVO);
+ }
+
/// \brief Create the initialization entity for an exception object.
static InitializedEntity InitializeException(SourceLocation ThrowLoc,
QualType Type, bool NRVO) {
OpenPOWER on IntegriCloud