[all-commits] [llvm/llvm-project] b39601: [Clang] Support typedef with btf_decl_tag attributes

yonghong-song via All-commits all-commits at lists.llvm.org
Thu Oct 21 08:42:24 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b396010240cda92f5fcfa30cba1b9ad905561eae
      https://github.com/llvm/llvm-project/commit/b396010240cda92f5fcfa30cba1b9ad905561eae
  Author: Yonghong Song <yhs at fb.com>
  Date:   2021-10-21 (Thu, 21 Oct 2021)

  Changed paths:
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/test/Misc/pragma-attribute-supported-attributes-list.test
    M clang/test/Sema/attr-btf_tag.c

  Log Message:
  -----------
  [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




More information about the All-commits mailing list