1 // RUN: %clang_cc1 %s -triple=%itanium_abi_triple -O1 -emit-llvm -fextend-variable-liveness -o - | FileCheck %s
2 // Make sure we don't crash compiling a lambda that is not nested in a function.
3 // We also check that fake uses are properly issued in lambdas.
13 const int S::a
= [](int b
) __attribute__((noinline
)) {
19 return ([=](int lambdaparm
) __attribute__((noinline
))->int {
20 int lambdalocal
= lambdaparm
* 2;
25 // We are looking for the first lambda's call operator, which should contain
26 // 2 fake uses, one for 'b' and one for its 'this' pointer (in that order).
27 // The mangled function name contains a $_0, followed by 'cl'.
28 // This lambda is an orphaned lambda, i.e. one without lexical parent.
30 // CHECK-LABEL: define internal {{.+\"_Z.+\$_0.*cl.*\"}}
32 // CHECK: fake.use(i32
34 // CHECK: fake.use(ptr
36 // The second lambda. We are looking for 3 fake uses.
37 // CHECK-LABEL: define internal {{.+\"_Z.+\$_0.*cl.*\"}}
39 // CHECK: fake.use(i32
41 // CHECK: fake.use(i32
43 // CHECK: fake.use(ptr