> Of the two problems discussed: > > 1. DW_TAG_LLVM_annotation not being able to denote annotations to > non-pointed based types. clang currently ignores these instances. > > We discussed two possible options to deal with this: > 1.1 To continue ignoring these cases in the front-end, keep the dwarf > expressiveness limitation, and document it. > 1.2 To change DW_TAG_LLVM_annotation so it behaves like a qualifier > DIE (like const, volatile, etc.) so it can apply to any type. Note that the non-pointed based types don't have to be basic types. The limitation also impacts non-basic types that are not pointed to, including pointer types themselves. Therefore: > : int * __tag1 * __tag2 h; > > - sparse > + __tag1 applies to int*, __tag2 applies to int** > : got int *[noderef] __tag1 *[addressable] [noderef] [toplevel] __tag2 h > - clang > + According to DWARF __tag1 applies to int*, no __tag2 (??). > + According to BTF __tag1 applies to int*, no __tag2 (??). > : DWARF > : 0x00000023: DW_TAG_variable > : DW_AT_name ("h") > : DW_AT_type (0x0000002e "int **") > : > : 0x0000002e: DW_TAG_pointer_type > : DW_AT_type (0x00000037 "int *") > : > : 0x00000033: DW_TAG_LLVM_annotation > : DW_AT_name ("btf_type_tag") > : DW_AT_const_value ("tag1") > : BTF > : [1] TYPE_TAG 'tag1' type_id=3 > : [2] PTR '(anon)' type_id=1 > : [3] PTR '(anon)' type_id=4 > : [4] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED > : [5] VAR 'h' type_id=2, linkage=global > : > : 'h' -> ptr -> 'tag1' -> ptr -> int In the example above, `tag2' doesn't appear in neither DWARF nor BTF because the type int** isn't pointed itself, and as Yonghong mentioned in the call, the implementation of btf_type_tag in clang ignores these cases.