[clang] [clang] Add clang::debug_info_type attribute for bitfields (PR #69104)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 18 12:30:19 PDT 2023
================
@@ -7219,6 +7219,18 @@ its underlying representation to be a WebAssembly ``funcref``.
}];
}
+def DebugInfoTypeDocumentation : Documentation {
+ let Category = DocCatField;
+ let Content = [{
+This attribute allows to alter type of a bitfield in debug information.
+Such a need might arise when bitfield is intended to store an enumeration value,
+but has to be specified as having enumeration's underlying type, in order to
+facilitate compiler optimizations. But this also causes underlying type to be
+emitted in debug information, making it hard for debuggers to map bitfield's
+value back to enumeration. This attribute helps with this.
+ }];
----------------
erichkeane wrote:
This whole bit of documentation reads REALLY awkwardly and has a couple of sentences that are run-on or not-full sentences. AS a strawman:
"
Attribute `[[<whateverwenameit>]]` provides a mechanism to alter the type in debug information of a bitfield. This is useful as it enables a better debug experience in cases where, for layout or other performance purposes, an enumeration value is best represented in a structure as a bitfield. By changing the type in the debug information, the layout is untouched, but debuggers are able to map the bitfield's values back to the enumeration values they represent.
"
https://github.com/llvm/llvm-project/pull/69104
More information about the cfe-commits
mailing list