2014-06-06 06:10:59 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2018-06-20 06:47:53 +08:00
|
|
|
// RUN: %clang -target i386-apple-darwin -std=c++11 -fblocks -Wframe-larger-than=70 -Wno-stdlibcxx-not-found -Xclang -verify -o /dev/null -c %s
|
|
|
|
// RUN: %clang -target i386-apple-darwin -std=c++11 -fblocks -Wframe-larger-than=70 -Wno-stdlibcxx-not-found -Xclang -verify -o /dev/null -c %s -DIS_SYSHEADER
|
2014-06-06 06:10:59 +08:00
|
|
|
|
|
|
|
// Test that:
|
|
|
|
// * The driver passes the option through to the backend.
|
|
|
|
// * The frontend diagnostic handler 'demangles' and resolves the correct function definition.
|
|
|
|
|
2014-07-10 10:13:29 +08:00
|
|
|
// Test that link invocations don't emit an "argument unused during compilation" diagnostic.
|
|
|
|
// RUN: touch %t.o
|
2017-03-16 00:35:13 +08:00
|
|
|
// RUN: %clang -Werror -Wno-msvc-not-found -Wno-liblto -Wframe-larger-than=0 %t.o -### 2>&1 | not grep ' error: '
|
2014-07-10 10:13:29 +08:00
|
|
|
|
2014-06-06 06:10:59 +08:00
|
|
|
// TODO: Support rich backend diagnostics for Objective-C methods.
|
|
|
|
|
2014-06-10 15:03:25 +08:00
|
|
|
// Backend diagnostics aren't suppressed in system headers because such results
|
|
|
|
// are significant and actionable.
|
|
|
|
#ifdef IS_HEADER
|
|
|
|
|
|
|
|
#ifdef IS_SYSHEADER
|
|
|
|
#pragma clang system_header
|
|
|
|
#endif
|
|
|
|
|
2014-06-06 06:10:59 +08:00
|
|
|
extern void doIt(char *);
|
|
|
|
|
|
|
|
void frameSizeWarning(int, int) {}
|
|
|
|
|
|
|
|
void frameSizeWarning();
|
|
|
|
|
|
|
|
void frameSizeWarning() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in function 'frameSizeWarning'}}
|
|
|
|
char buffer[80];
|
|
|
|
doIt(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void frameSizeWarning();
|
|
|
|
|
|
|
|
void frameSizeWarning(int) {}
|
|
|
|
|
2014-06-10 07:59:38 +08:00
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wframe-larger-than="
|
|
|
|
void frameSizeWarningIgnored() {
|
|
|
|
char buffer[80];
|
|
|
|
doIt(buffer);
|
|
|
|
}
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
|
2014-06-10 15:03:25 +08:00
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#ifndef IS_SYSHEADER
|
|
|
|
// expected-warning@+2 {{unknown warning group '-Wframe-larger-than'}}
|
|
|
|
#endif
|
|
|
|
#pragma GCC diagnostic ignored "-Wframe-larger-than"
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
|
2014-06-06 06:10:59 +08:00
|
|
|
void frameSizeLocalClassWarning() {
|
|
|
|
struct S {
|
|
|
|
S() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in function 'frameSizeLocalClassWarning()::S::S'}}
|
|
|
|
char buffer[80];
|
|
|
|
doIt(buffer);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
S();
|
|
|
|
}
|
|
|
|
|
|
|
|
void frameSizeLambdaWarning() {
|
|
|
|
auto fn =
|
|
|
|
[]() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in lambda expression}}
|
|
|
|
char buffer[80];
|
|
|
|
doIt(buffer);
|
|
|
|
};
|
|
|
|
fn();
|
|
|
|
}
|
|
|
|
|
|
|
|
void frameSizeBlocksWarning() {
|
|
|
|
auto fn =
|
|
|
|
^() { // expected-warning-re {{stack frame size of {{[0-9]+}} bytes in block literal}}
|
|
|
|
char buffer[80];
|
|
|
|
doIt(buffer);
|
|
|
|
};
|
|
|
|
fn();
|
|
|
|
}
|
2014-06-10 15:03:25 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define IS_HEADER
|
|
|
|
#include __FILE__
|
|
|
|
#endif
|