summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaLambda.cpp8
-rw-r--r--clang/test/CodeGenCXX/captured-statements.cpp1
-rw-r--r--clang/test/OpenMP/target_map_codegen.cpp4
3 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp
index 0de501fc5e4..9be8fe51887 100644
--- a/clang/lib/Sema/SemaLambda.cpp
+++ b/clang/lib/Sema/SemaLambda.cpp
@@ -311,18 +311,20 @@ Sema::getCurrentMangleNumberContext(const DeclContext *DC,
bool IsInNonspecializedTemplate =
!ActiveTemplateInstantiations.empty() || CurContext->isDependentContext();
switch (Kind) {
- case Normal:
+ case Normal: {
// -- the bodies of non-exported nonspecialized template functions
// -- the bodies of inline functions
+ auto *CD = dyn_cast<CapturedDecl>(CurContext);
if ((IsInNonspecializedTemplate &&
!(ManglingContextDecl && isa<ParmVarDecl>(ManglingContextDecl))) ||
- isInInlineFunction(CurContext)) {
+ isInInlineFunction(CurContext) || CD) {
ManglingContextDecl = nullptr;
- return &Context.getManglingNumberContext(DC);
+ return &Context.getManglingNumberContext(CD ? CD->getParent() : DC);
}
ManglingContextDecl = nullptr;
return nullptr;
+ }
case StaticDataMember:
// -- the initializers of nonspecialized static members of template classes
diff --git a/clang/test/CodeGenCXX/captured-statements.cpp b/clang/test/CodeGenCXX/captured-statements.cpp
index fdda24fcf30..4b95503ad7b 100644
--- a/clang/test/CodeGenCXX/captured-statements.cpp
+++ b/clang/test/CodeGenCXX/captured-statements.cpp
@@ -78,6 +78,7 @@ void test3(int x) {
{
x = [=]() { return x + 1; } ();
}
+ x = [=]() { return x + 1; }();
// CHECK-3: %[[Capture:struct\.anon[\.0-9]*]] = type { i32* }
diff --git a/clang/test/OpenMP/target_map_codegen.cpp b/clang/test/OpenMP/target_map_codegen.cpp
index 92ed0abf949..72c7257a0ea 100644
--- a/clang/test/OpenMP/target_map_codegen.cpp
+++ b/clang/test/OpenMP/target_map_codegen.cpp
@@ -4104,7 +4104,9 @@ int explicit_maps_with_inner_lambda(int a){
// CK25: [[VAL1:%.+]] = load i32*, i32** [[VALADDR]],
// CK25: [[VALADDR1:%.+]] = getelementptr inbounds [[CA01]], [[CA01]]* [[CA:%[^,]+]], i32 0, i32 0
// CK25: store i32* [[VAL1]], i32** [[VALADDR1]],
-// CK25: call void {{.*}}[[LAMBDA]]{{.*}}([[CA01]]* [[CA]])
+// CK25: call void {{.*}}[[LAMBDA2:@.+]]{{.*}}([[CA01]]* [[CA]])
+
+// CK25: define {{.+}}[[LAMBDA2]]
#endif
///==========================================================================///
// RUN: %clang_cc1 -DCK26 -std=c++11 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK26 --check-prefix CK26-64
OpenPOWER on IntegriCloud