1 // REQUIRES: x86-registered-target
2 // RUN: %clang -target i386-apple-darwin -std=c++11 -fblocks -Wframe-larger-than=70 -Xclang -verify -o /dev/null -c %s
3 
4 // Test that:
5 //  * The driver passes the option through to the backend.
6 //  * The frontend diagnostic handler 'demangles' and resolves the correct function definition.
7 
8 // TODO: Support rich backend diagnostics for Objective-C methods.
9 
10 extern void doIt(char *);
11 
12 void frameSizeWarning(int, int) {}
13 
14 void frameSizeWarning();
15 
16 void frameSizeWarning() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in function 'frameSizeWarning'}}
17   char buffer[80];
18   doIt(buffer);
19 }
20 
21 void frameSizeWarning();
22 
23 void frameSizeWarning(int) {}
24 
25 void frameSizeLocalClassWarning() {
26   struct S {
27     S() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in function 'frameSizeLocalClassWarning()::S::S'}}
28       char buffer[80];
29       doIt(buffer);
30     }
31   };
32   S();
33 }
34 
35 void frameSizeLambdaWarning() {
36   auto fn =
37       []() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in lambda expression}}
38     char buffer[80];
39     doIt(buffer);
40   };
41   fn();
42 }
43 
44 void frameSizeBlocksWarning() {
45   auto fn =
46       ^() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in block literal}}
47     char buffer[80];
48     doIt(buffer);
49   };
50   fn();
51 }
52