brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 2059ab5 Raw
79 lines · cpp
1// REQUIRES: x86-registered-target2// RUN: %clang -target i386-apple-darwin -std=c++11 -fblocks -Wframe-larger-than=70 -Wno-stdlibcxx-not-found -Xclang -verify -o /dev/null -c %s3// 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_SYSHEADER4 5// Test that:6//  * The driver passes the option through to the backend.7//  * The frontend diagnostic handler 'demangles' and resolves the correct function definition.8 9// Test that link invocations don't emit an "argument unused during compilation" diagnostic.10// RUN: touch %t.o11// RUN: %clang -Werror -Wno-msvc-not-found -Wno-liblto -Wframe-larger-than=0 %t.o -###  2>&1 | not grep ' error: '12 13// TODO: Support rich backend diagnostics for Objective-C methods.14 15// Backend diagnostics aren't suppressed in system headers because such results16// are significant and actionable.17#ifdef IS_HEADER18 19#ifdef IS_SYSHEADER20#pragma clang system_header21#endif22 23extern void doIt(char *);24 25void frameSizeWarning(int, int) {}26 27void frameSizeWarning();28 29void frameSizeWarning() { // expected-warning-re {{stack frame size ({{[0-9]+}}) exceeds limit ({{[0-9]+}}) in 'frameSizeWarning()'}}30  char buffer[80];31  doIt(buffer);32}33 34void frameSizeWarning();35 36void frameSizeWarning(int) {}37 38#pragma GCC diagnostic push39#pragma GCC diagnostic ignored "-Wframe-larger-than"40void frameSizeWarningIgnored() {41  char buffer[80];42  doIt(buffer);43}44#pragma GCC diagnostic pop45 46void frameSizeLocalClassWarning() {47  struct S {48    S() { // expected-warning-re {{stack frame size ({{[0-9]+}}) exceeds limit ({{[0-9]+}}) in 'frameSizeLocalClassWarning()::S::S()'}}49      char buffer[80];50      doIt(buffer);51    }52  };53  S();54}55 56void frameSizeLambdaWarning() {57  auto fn =58      []() { // expected-warning-re {{stack frame size ({{[0-9]+}}) exceeds limit ({{[0-9]+}}) in 'frameSizeLambdaWarning()::$_0::operator()() const'}}59    char buffer[80];60    doIt(buffer);61  };62  fn();63}64 65void frameSizeBlocksWarning() {66  auto fn =67      ^() { // expected-warning-re {{stack frame size ({{[0-9]+}}) exceeds limit ({{[0-9]+}}) in 'invocation function for block in frameSizeBlocksWarning()'}}68    char buffer[80];69    doIt(buffer);70  };71  fn();72}73 74#else75 76#define IS_HEADER77#include __FILE__78#endif79