mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 17:26:07 +00:00

This was motivated by the fact that constructor type homing (debug info optimization that we want to turn on by default) drops some libc++ types, so an attribute would allow us to override constructor homing and emit them anyway. I'm currently looking into the particular libc++ issue, but even if we do fix that, this issue might come up elsewhere and it might be nice to have this. As I've implemented it now, the attribute isn't specific to the constructor homing optimization and overrides all of the debug info optimizations. Open to discussion about naming, specifics on what the attribute should do, etc. Differential Revision: https://reviews.llvm.org/D97411
15 lines
639 B
C++
15 lines
639 B
C++
// RUN: %clang_cc1 %s -verify -fsyntax-only
|
|
// RUN: %clang_cc1 %s -verify -fsyntax-only -x c
|
|
|
|
#ifdef __cplusplus
|
|
int a __attribute__((standalone_debug)); // expected-warning {{'standalone_debug' attribute only applies to classes}}
|
|
|
|
void __attribute__((standalone_debug)) b(); // expected-warning {{'standalone_debug' attribute only applies to classes}}
|
|
|
|
struct __attribute__((standalone_debug(1))) c {}; // expected-error {{'standalone_debug' attribute takes no arguments}}
|
|
|
|
#else
|
|
// Check that attribute only works in C++.
|
|
struct __attribute__((standalone_debug)) a {}; // expected-warning {{'standalone_debug' attribute ignored}}
|
|
#endif
|