llvm-project/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp
Arthur Eubanks 2568286892 [clang] Don't use the AST to display backend diagnostics
We keep a map from function name to source location so we don't have to
do it via looking up a source location from the AST. However, since
function names can be long, we actually use a hash of the function name
as the key.

Additionally, we can't rely on Clang's printing of function names via
the AST, so we just demangle the name instead.

This is necessary to implement
https://lists.llvm.org/pipermail/cfe-dev/2021-September/068930.html.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D110665
2021-10-04 14:14:32 -07:00

21 lines
742 B
C++

// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -fwarn-stack-size=0 -emit-codegen-only -triple=i386-apple-darwin 2>&1 | FileCheck %s
// TODO: Emit rich diagnostics for thunks and move this into the appropriate test file.
// Until then, test that we fall back and display the LLVM backend diagnostic.
namespace frameSizeThunkWarning {
struct A {
virtual void f();
};
struct B : virtual A {
virtual void f();
};
// CHECK: warning: stack frame size ([[#]]) exceeds limit ([[#]]) in 'frameSizeThunkWarning::B::f()'
// CHECK: warning: stack frame size ([[#]]) exceeds limit ([[#]]) in function '_ZTv0_n12_N21frameSizeThunkWarning1B1fEv'
void B::f() {
volatile int x = 0; // Ensure there is stack usage.
}
}