[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / x86-diag-excessive-regsave.c
blob8b580e60c54514e4adc712655bcae7223e6e341e
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s -DNO_CALLER_SAVED_REGISTERS=1
3 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature -x87 -target-feature -mmx -target-feature -sse -fsyntax-only -verify %s -DGPRONLY=1
5 #if defined(NO_CALLER_SAVED_REGS) || defined(GPRONLY)
6 // expected-no-diagnostics
7 #else
8 #define EXPECT_WARNING
9 #endif
11 #ifdef NO_CALLER_SAVED_REGS
12 __attribute__((no_caller_saved_registers))
13 #endif
14 #ifdef EXPECT_WARNING
15 // expected-note@+3 {{'foo' declared here}}
16 // expected-note@+2 {{'foo' declared here}}
17 #endif
18 extern void foo(void *);
20 __attribute__((no_caller_saved_registers))
21 void no_caller_saved_registers(void *arg) {
22 #ifdef EXPECT_WARNING
23 // expected-warning@+2 {{function with attribute 'no_caller_saved_registers' should only call a function with attribute 'no_caller_saved_registers' or be compiled with '-mgeneral-regs-only'}}
24 #endif
25 foo(arg);
28 __attribute__((interrupt))
29 void interrupt(void *arg) {
30 #ifdef EXPECT_WARNING
31 // expected-warning@+2 {{interrupt service routine should only call a function with attribute 'no_caller_saved_registers' or be compiled with '-mgeneral-regs-only'}}
32 #endif
33 foo(arg);