[Clang] Support typedef with btf_decl_tag attributes
authorYonghong Song <yhs@fb.com>
Tue, 21 Sep 2021 02:53:19 +0000 (19:53 -0700)
committerYonghong Song <yhs@fb.com>
Thu, 21 Oct 2021 15:41:49 +0000 (08:41 -0700)
commitb396010240cda92f5fcfa30cba1b9ad905561eae
tree80a90fcd9e1ebfc1b02372dfab225afa7cda45e9
parent56df1d80e2911a8cd23b70e9b7e76fcb386c7956
[Clang] Support typedef with btf_decl_tag attributes

Previously, btf_del_tag attribute supports record, field, global variable,
function and function parameter ([1], [2]). This patch added support for typedef.
The main reason is for typedef of an anonymous struct/union, we can only apply
btf_decl_tag attribute to the anonymous struct/union like below:
  typedef struct { ... } __btf_decl_tag target_type
In this case, the __btf_decl_tag attribute applies to anonymous struct,
which increases downstream implementation complexity. But if
typedef with btf_decl_tag attribute is supported, we can have
  typedef struct { ... } target_type __btf_decl_tag
which applies __btf_decl_tag to typedef "target_type" which make it
easier to directly associate btf_decl_tag with a named type.
This patch permitted btf_decl_tag with typedef types with this reason.

 [1] https://reviews.llvm.org/D106614
 [2] https://reviews.llvm.org/D111588

Differential Revision: https://reviews.llvm.org/D110127
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/Sema/attr-btf_tag.c