[PATCH] D146595: [clang] Add "debug_trampoline" attribute

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 10 10:47:21 PDT 2023


aaron.ballman added a comment.

The Clang attribute bits generally LG, but I don't know enough on the debug info bits to say. In terms of behavior in PDB files, I'd still like for this attribute to be supported across all debug info formats. If we know this attribute is going to be ignored for a particular debug format, I think we should issue the usual "attribute ignored" diagnostics so that users are not surprised the attribute does nothing (I think the metric for this should be "can the attribute ever do what the user expects on this target?" -- so not using `-g` wouldn't issue the attribute ignored diagnostic on a target using DWARF because the attribute could do what the user expects there if the user enabled debug info). But that said, I'll defer to what the debug info code owners think is the best approach to take.



================
Comment at: clang/test/CodeGen/attr-debug-trampoline-method.cpp:15
+}
+
+// CHECK: DISubprogram(name: "foo"{{.*}} DISPFlagIsDebugTrampoline
----------------
Can you also show a use on a lambda to demonstrate we codegen that properly?


================
Comment at: clang/test/Sema/attr-debug-trampoline.c:1
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+
----------------
I'd probably drop this test file entirely as the C++ file covers the testing needs (we don't usually ask for tests duplicated across spellings unless the spelling is important for some reason).


================
Comment at: clang/test/SemaCXX/attr-debug-trampoline-method.cpp:11
+};
+
----------------
Can you also add tests like:
```
[[clang::debug_trampoline]] int var; // Error, not allowed on something other than a function

[[clang::debug_trampoline]] void free_function(); // OK

typedef void (*fp)() [[clang::debug_trampoline]]; // Error, not allowed on a type
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146595/new/

https://reviews.llvm.org/D146595



More information about the cfe-commits mailing list