1 // RUN: %clang_cc1 -triple x86_64-linux-gnu %s -emit-llvm -o - \
2 // RUN: -Werror=unknown-attributes \
3 // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-NOM
4 // RUN: %clang_cc1 -triple x86_64-linux-gnu %s -emit-llvm -o - \
5 // RUN: -Werror=unknown-attributes -mfunction-return=keep \
6 // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-KEEP
7 // RUN: %clang_cc1 -triple x86_64-linux-gnu %s -emit-llvm -o - \
8 // RUN: -Werror=unknown-attributes -mfunction-return=thunk-extern \
9 // RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-EXTERN
12 // CHECK: @"_ZZ3foovENK3$_0clEv"({{.*}}) [[NOATTR:#[0-9]+]]
18 // CHECK: @"_ZZ3barvENK3$_0clEv"({{.*}}) [[EXTERN:#[0-9]+]]
19 return []() __attribute__((function_return("thunk-extern"))) {
25 // CHECK: @"_ZZ3bazvENK3$_0clEv"({{.*}}) [[KEEP:#[0-9]+]]
26 return []() __attribute__((function_return("keep"))) {
34 // CHECK: @_ZN3Foo3fooEv({{.*}}) [[EXTERN]]
35 __attribute__((function_return("thunk-extern"))) int foo() { return 42; }
43 // CHECK: @extern_c() [[EXTERN]]
44 extern "C" __attribute__((function_return("thunk-extern"))) void extern_c() {}
46 // CHECK: @extern_c2() [[EXTERN]]
47 __attribute__((function_return("thunk-extern"))) void extern_c2() {}
50 // CHECK-NOM-NOT: [[NOATTR]] = {{.*}}fn_ret_thunk_extern
51 // CHECK-KEEP-NOT: [[NOATTR]] = {{.*}}fn_ret_thunk_extern
52 // CHECK-KEEP-NOT: [[KEEP]] = {{.*}}fn_ret_thunk_extern
53 // CHECK-EXTERN: [[EXTERN]] = {{.*}}fn_ret_thunk_extern