llvm-project/clang/test/Misc/backend-stack-frame-diagnostics-attributes.cpp
Yi Kong 5fc4828aa6 [clang] Don't generate warn-stack-size when the warning is ignored
8ace12130526 introduced a regression for code that explicitly ignores the
-Wframe-larger-than= warning. Make sure we don't generate the
warn-stack-size attribute for that case.

Differential Revision: https://reviews.llvm.org/D108686
2021-08-25 14:58:45 +08:00

25 lines
616 B
C++

// Test the warn-stack-size function attribute is not generated when -Wframe-larger-than is ignored
// through pragma.
// RUN: %clang_cc1 -fwarn-stack-size=70 -emit-llvm -o - %s | FileCheck %s
// CHECK: "warn-stack-size"="70"
// RUN: %clang_cc1 -DIGNORED -fwarn-stack-size=70 -emit-llvm -o - %s | FileCheck %s --check-prefix=IGNORED
// IGNORED-NOT: "warn-stack-size"="70"
extern void doIt(char *);
#ifdef IGNORED
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wframe-larger-than"
#endif
void frameSizeAttr() {
char buffer[80];
doIt(buffer);
}
#ifdef IGNORED
#pragma GCC diagnostic pop
#endif