xref: /llvm-project/clang/test/Misc/backend-stack-frame-diagnostics-attributes.cpp (revision 5fc4828aa6c6df03bd98b1f066e85655383d0cce)
1 // Test the warn-stack-size function attribute is not generated when -Wframe-larger-than is ignored
2 // through pragma.
3 
4 // RUN: %clang_cc1 -fwarn-stack-size=70 -emit-llvm -o - %s | FileCheck %s
5 // CHECK: "warn-stack-size"="70"
6 
7 // RUN: %clang_cc1 -DIGNORED -fwarn-stack-size=70 -emit-llvm -o - %s | FileCheck %s --check-prefix=IGNORED
8 // IGNORED-NOT: "warn-stack-size"="70"
9 
10 extern void doIt(char *);
11 
12 #ifdef IGNORED
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wframe-larger-than"
15 #endif
16 
frameSizeAttr()17 void frameSizeAttr() {
18   char buffer[80];
19   doIt(buffer);
20 }
21 
22 #ifdef IGNORED
23 #pragma GCC diagnostic pop
24 #endif
25