diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -8129,6 +8129,12 @@ case ParsedAttr::IgnoredAttribute: break; + case ParsedAttr::AT_BTFTag: + // FIXME: Linux kernel may also use this attribute for type casting check, + // which clang doesn's support for now. Let us ignore them so linux kernel + // build won't break. + attr.setUsedAsTypeAttr(); + break; case ParsedAttr::AT_MayAlias: // FIXME: This attribute needs to actually be handled, but if we ignore // it it breaks large amounts of Linux software. diff --git a/clang/test/Sema/attr-btf_tag.c b/clang/test/Sema/attr-btf_tag.c --- a/clang/test/Sema/attr-btf_tag.c +++ b/clang/test/Sema/attr-btf_tag.c @@ -40,3 +40,7 @@ int __tag1 foo(struct t1 *arg __tag1, struct t2 *arg2) { return arg->a + arg2->a; } + +void __tag1 * convert(long arg) { + return (void __tag1 *)arg; +}