diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1836,11 +1836,11 @@ let LangOpts = [COnly]; } -def BTFTag : InheritableAttr { - let Spellings = [Clang<"btf_tag">]; - let Args = [StringArgument<"BTFTag">]; +def BTFDeclTag : InheritableAttr { + let Spellings = [Clang<"btf_decl_tag">]; + let Args = [StringArgument<"BTFDeclTag">]; let Subjects = SubjectList<[Var, Function, Record, Field], ErrorDiag>; - let Documentation = [BTFTagDocs]; + let Documentation = [BTFDeclTagDocs]; let LangOpts = [COnly]; } diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -2011,12 +2011,12 @@ struct or union, similar to clang ``__builtin_preserve_access_index()``. }]; } -def BTFTagDocs : Documentation { +def BTFDeclTagDocs : Documentation { let Category = DocCatFunction; let Content = [{ -Clang supports the ``__attribute__((btf_tag("ARGUMENT")))`` attribute for all -targets. This attribute may be attached to a struct/union, struct/union field, -function, function parameter or variable declaration. If -g is specified, +Clang supports the ``__attribute__((btf_decl_tag("ARGUMENT")))`` attribute for +all targets. This attribute may be attached to a struct/union, struct/union +field, function, function parameter or variable declaration. If -g is specified, the ``ARGUMENT`` info will be preserved in IR and be emitted to dwarf. For BPF targets, the ``ARGUMENT`` info will be emitted to .BTF ELF section too. }]; diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -3390,7 +3390,7 @@ EnforceTCBAttr *mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL); EnforceTCBLeafAttr *mergeEnforceTCBLeafAttr(Decl *D, const EnforceTCBLeafAttr &AL); - BTFTagAttr *mergeBTFTagAttr(Decl *D, const BTFTagAttr &AL); + BTFDeclTagAttr *mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL); void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK = AMK_Redeclaration); diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -300,8 +300,8 @@ llvm::DINodeArray CollectCXXTemplateParams(const RecordDecl *TS, llvm::DIFile *F); - /// A helper function to collect debug info for btf_tag annotations. - llvm::DINodeArray CollectBTFTagAnnotations(const Decl *D); + /// A helper function to collect debug info for btf_decl_tag annotations. + llvm::DINodeArray CollectBTFDeclTagAnnotations(const Decl *D); llvm::DIType *createFieldType(StringRef name, QualType type, SourceLocation loc, AccessSpecifier AS, diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1424,7 +1424,7 @@ Offset = BitFieldInfo.StorageSize - BitFieldInfo.Size - Offset; uint64_t OffsetInBits = StorageOffsetInBits + Offset; llvm::DINode::DIFlags Flags = getAccessFlag(BitFieldDecl->getAccess(), RD); - llvm::DINodeArray Annotations = CollectBTFTagAnnotations(BitFieldDecl); + llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(BitFieldDecl); return DBuilder.createBitFieldMemberType( RecordTy, Name, File, Line, SizeInBits, OffsetInBits, StorageOffsetInBits, Flags, DebugType, Annotations); @@ -1541,7 +1541,7 @@ FieldType = createBitFieldType(field, RecordTy, RD); } else { auto Align = getDeclAlignIfRequired(field, CGM.getContext()); - llvm::DINodeArray Annotations = CollectBTFTagAnnotations(field); + llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(field); FieldType = createFieldType(name, type, field->getLocation(), field->getAccess(), OffsetInBits, Align, tunit, RecordTy, RD, Annotations); @@ -2141,15 +2141,15 @@ return CollectTemplateParams(GetTemplateArgs(RD), Unit); } -llvm::DINodeArray CGDebugInfo::CollectBTFTagAnnotations(const Decl *D) { - if (!D->hasAttr()) +llvm::DINodeArray CGDebugInfo::CollectBTFDeclTagAnnotations(const Decl *D) { + if (!D->hasAttr()) return nullptr; SmallVector Annotations; - for (const auto *I : D->specific_attrs()) { + for (const auto *I : D->specific_attrs()) { llvm::Metadata *Ops[2] = { - llvm::MDString::get(CGM.getLLVMContext(), StringRef("btf_tag")), - llvm::MDString::get(CGM.getLLVMContext(), I->getBTFTag())}; + llvm::MDString::get(CGM.getLLVMContext(), StringRef("btf_decl_tag")), + llvm::MDString::get(CGM.getLLVMContext(), I->getBTFDeclTag())}; Annotations.push_back(llvm::MDNode::get(CGM.getLLVMContext(), Ops)); } return DBuilder.getOrCreateArray(Annotations); @@ -3527,7 +3527,7 @@ Flags |= llvm::DINode::FlagExportSymbols; } - llvm::DINodeArray Annotations = CollectBTFTagAnnotations(D); + llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D); llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType( getTagForRecord(RD), RDName, RDContext, DefUnit, Line, 0, Size, Align, Flags, Identifier, Annotations); @@ -4047,7 +4047,7 @@ Decl = isa(D) ? getObjCMethodDeclaration(D, DIFnType, LineNo, Flags, SPFlags) : getFunctionDeclaration(D); - Annotations = CollectBTFTagAnnotations(D); + Annotations = CollectBTFDeclTagAnnotations(D); } // FIXME: The function declaration we're constructing here is mostly reusing @@ -4117,7 +4117,7 @@ if (CGM.getLangOpts().Optimize) SPFlags |= llvm::DISubprogram::SPFlagOptimized; - llvm::DINodeArray Annotations = CollectBTFTagAnnotations(D); + llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D); llvm::DISubprogram *SP = DBuilder.createFunction( FDContext, Name, LinkageName, Unit, LineNo, getOrCreateFunctionType(D, FnType, Unit), ScopeLine, Flags, SPFlags, @@ -4458,7 +4458,7 @@ // Create the descriptor for the variable. llvm::DILocalVariable *D = nullptr; if (ArgNo) { - llvm::DINodeArray Annotations = CollectBTFTagAnnotations(VD); + llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(VD); D = DBuilder.createParameterVariable(Scope, Name, *ArgNo, Unit, Line, Ty, CGM.getLangOpts().Optimize, Flags, Annotations); @@ -5079,7 +5079,7 @@ } AppendAddressSpaceXDeref(AddressSpace, Expr); - llvm::DINodeArray Annotations = CollectBTFTagAnnotations(D); + llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D); GVE = DBuilder.createGlobalVariableExpression( DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, Unit), Var->hasLocalLinkage(), true, diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2679,8 +2679,8 @@ NewAttr = S.mergeEnforceTCBAttr(D, *TCBA); else if (const auto *TCBLA = dyn_cast(Attr)) NewAttr = S.mergeEnforceTCBLeafAttr(D, *TCBLA); - else if (const auto *BTFA = dyn_cast(Attr)) - NewAttr = S.mergeBTFTagAttr(D, *BTFA); + else if (const auto *BTFA = dyn_cast(Attr)) + NewAttr = S.mergeBTFDeclTagAttr(D, *BTFA); else if (Attr->shouldInheritEvenIfAlreadyPresent() || !DeclHasAttr(D, Attr)) NewAttr = cast(Attr->clone(S.Context)); diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -6887,28 +6887,28 @@ Rec->addAttr(::new (S.Context) BPFPreserveAccessIndexAttr(S.Context, AL)); } -static bool hasBTFTagAttr(Decl *D, StringRef Tag) { - for (const auto *I : D->specific_attrs()) { - if (I->getBTFTag() == Tag) +static bool hasBTFDeclTagAttr(Decl *D, StringRef Tag) { + for (const auto *I : D->specific_attrs()) { + if (I->getBTFDeclTag() == Tag) return true; } return false; } -static void handleBTFTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) { +static void handleBTFDeclTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) { StringRef Str; if (!S.checkStringLiteralArgumentAttr(AL, 0, Str)) return; - if (hasBTFTagAttr(D, Str)) + if (hasBTFDeclTagAttr(D, Str)) return; - D->addAttr(::new (S.Context) BTFTagAttr(S.Context, AL, Str)); + D->addAttr(::new (S.Context) BTFDeclTagAttr(S.Context, AL, Str)); } -BTFTagAttr *Sema::mergeBTFTagAttr(Decl *D, const BTFTagAttr &AL) { - if (hasBTFTagAttr(D, AL.getBTFTag())) +BTFDeclTagAttr *Sema::mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL) { + if (hasBTFDeclTagAttr(D, AL.getBTFDeclTag())) return nullptr; - return ::new (Context) BTFTagAttr(Context, AL, AL.getBTFTag()); + return ::new (Context) BTFDeclTagAttr(Context, AL, AL.getBTFDeclTag()); } static void handleWebAssemblyExportNameAttr(Sema &S, Decl *D, const ParsedAttr &AL) { @@ -7947,8 +7947,8 @@ case ParsedAttr::AT_BPFPreserveAccessIndex: handleBPFPreserveAccessIndexAttr(S, D, AL); break; - case ParsedAttr::AT_BTFTag: - handleBTFTagAttr(S, D, AL); + case ParsedAttr::AT_BTFDeclTag: + handleBTFDeclTagAttr(S, D, AL); break; case ParsedAttr::AT_WebAssemblyExportName: handleWebAssemblyExportNameAttr(S, D, AL); diff --git a/clang/test/CodeGen/attr-btf_tag-dicomposite-2.c b/clang/test/CodeGen/attr-btf_tag-dicomposite-2.c --- a/clang/test/CodeGen/attr-btf_tag-dicomposite-2.c +++ b/clang/test/CodeGen/attr-btf_tag-dicomposite-2.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) struct __tag1 __tag2 t1; diff --git a/clang/test/CodeGen/attr-btf_tag-dicomposite.c b/clang/test/CodeGen/attr-btf_tag-dicomposite.c --- a/clang/test/CodeGen/attr-btf_tag-dicomposite.c +++ b/clang/test/CodeGen/attr-btf_tag-dicomposite.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) struct __tag1 __tag2 t1; struct t1 { @@ -15,8 +15,8 @@ // CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", file: ![[#]], line: [[#]], size: 32, elements: ![[#]], annotations: ![[ANNOT:[0-9]+]]) // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} -// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} -// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} +// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"} +// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"} struct __tag1 t2; struct __tag2 t2 { diff --git a/clang/test/CodeGen/attr-btf_tag-diglobalvariable.c b/clang/test/CodeGen/attr-btf_tag-diglobalvariable.c --- a/clang/test/CodeGen/attr-btf_tag-diglobalvariable.c +++ b/clang/test/CodeGen/attr-btf_tag-diglobalvariable.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) struct t1 { int a; @@ -15,8 +15,8 @@ // CHECK: distinct !DIGlobalVariable(name: "g1", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT:[0-9]+]]) // CHECK: distinct !DIGlobalVariable(name: "g2", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT]]) // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} -// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} -// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} +// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"} +// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"} extern struct t1 g3 __tag1; struct t1 g3 __tag2; diff --git a/clang/test/CodeGen/attr-btf_tag-disubprogram-callsite.c b/clang/test/CodeGen/attr-btf_tag-disubprogram-callsite.c --- a/clang/test/CodeGen/attr-btf_tag-disubprogram-callsite.c +++ b/clang/test/CodeGen/attr-btf_tag-disubprogram-callsite.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang -target x86_64 -g -S -O2 -emit-llvm -o - %s | FileCheck %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) struct t1 { int a; @@ -15,5 +15,5 @@ // CHECK: ![[#]] = !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]]) // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} -// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} -// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} +// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"} +// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"} diff --git a/clang/test/CodeGen/attr-btf_tag-disubprogram.c b/clang/test/CodeGen/attr-btf_tag-disubprogram.c --- a/clang/test/CodeGen/attr-btf_tag-disubprogram.c +++ b/clang/test/CodeGen/attr-btf_tag-disubprogram.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) struct t1 { int a; @@ -14,8 +14,8 @@ // CHECK: distinct !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], scopeLine: [[#]], flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]]) // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} -// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} -// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} +// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"} +// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"} int __tag1 __tag2 foo2(struct t1 *arg); int foo2(struct t1 *arg) { diff --git a/clang/test/CodeGen/attr-btf_tag-field.c b/clang/test/CodeGen/attr-btf_tag-field.c --- a/clang/test/CodeGen/attr-btf_tag-field.c +++ b/clang/test/CodeGen/attr-btf_tag-field.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) struct t1 { int a __tag1 __tag2; @@ -21,7 +21,7 @@ } // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 32, annotations: ![[ANNOT:[0-9]+]]) // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} -// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} -// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} +// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"} +// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"} // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 1, flags: DIFlagBitField, extraData: i64 0, annotations: ![[ANNOT]]) diff --git a/clang/test/CodeGen/attr-btf_tag-parameter.c b/clang/test/CodeGen/attr-btf_tag-parameter.c --- a/clang/test/CodeGen/attr-btf_tag-parameter.c +++ b/clang/test/CodeGen/attr-btf_tag-parameter.c @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target // RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) struct t1 { int a; @@ -14,5 +14,5 @@ // CHECK: !DILocalVariable(name: "arg", arg: 1, scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], annotations: ![[ANNOT:[0-9]+]]) // CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]} -// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"} -// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"} +// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"} +// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"} diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test b/clang/test/Misc/pragma-attribute-supported-attributes-list.test --- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test +++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test @@ -22,7 +22,7 @@ // CHECK-NEXT: Assumption (SubjectMatchRule_function, SubjectMatchRule_objc_method) // CHECK-NEXT: Availability ((SubjectMatchRule_record, SubjectMatchRule_enum, SubjectMatchRule_enum_constant, SubjectMatchRule_field, SubjectMatchRule_function, SubjectMatchRule_namespace, SubjectMatchRule_objc_category, SubjectMatchRule_objc_implementation, SubjectMatchRule_objc_interface, SubjectMatchRule_objc_method, SubjectMatchRule_objc_property, SubjectMatchRule_objc_protocol, SubjectMatchRule_record, SubjectMatchRule_type_alias, SubjectMatchRule_variable)) // CHECK-NEXT: BPFPreserveAccessIndex (SubjectMatchRule_record) -// CHECK-NEXT: BTFTag (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record, SubjectMatchRule_field) +// CHECK-NEXT: BTFDeclTag (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record, SubjectMatchRule_field) // CHECK-NEXT: BuiltinAlias (SubjectMatchRule_function) // CHECK-NEXT: CFAuditedTransfer (SubjectMatchRule_function) // CHECK-NEXT: CFConsumed (SubjectMatchRule_variable_is_parameter) 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 @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -x c -triple x86_64-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s -#define __tag1 __attribute__((btf_tag("tag1"))) -#define __tag2 __attribute__((btf_tag("tag2"))) -#define __tag3 __attribute__((btf_tag("tag3"))) +#define __tag1 __attribute__((btf_decl_tag("tag1"))) +#define __tag2 __attribute__((btf_decl_tag("tag2"))) +#define __tag3 __attribute__((btf_decl_tag("tag3"))) -#define __tag_no_arg __attribute__((btf_tag())) -#define __tag_2_arg __attribute__((btf_tag("tag1", "tag2"))) -#define __invalid __attribute__((btf_tag(1))) +#define __tag_no_arg __attribute__((btf_decl_tag())) +#define __tag_2_arg __attribute__((btf_decl_tag("tag1", "tag2"))) +#define __invalid __attribute__((btf_decl_tag(1))) struct __tag1 __tag2 t1; struct t1 { @@ -19,21 +19,21 @@ }; int g1 __tag1; -int g2 __tag_no_arg; // expected-error {{'btf_tag' attribute takes one argument}} -int g3 __tag_2_arg; // expected-error {{'btf_tag' attribute takes one argument}} -int i1 __invalid; // expected-error {{'btf_tag' attribute requires a string}} +int g2 __tag_no_arg; // expected-error {{'btf_decl_tag' attribute takes one argument}} +int g3 __tag_2_arg; // expected-error {{'btf_decl_tag' attribute takes one argument}} +int i1 __invalid; // expected-error {{'btf_decl_tag' attribute requires a string}} enum e1 { E1 -} __tag1; // expected-error {{'btf_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}} +} __tag1; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}} enum e2 { E2 -} __tag_no_arg; // expected-error {{'btf_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}} +} __tag_no_arg; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}} enum e3 { E3 -} __tag_2_arg; // expected-error {{'btf_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}} +} __tag_2_arg; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}} int __tag1 __tag2 foo(struct t1 *arg, struct t2 *arg2); int __tag2 __tag3 foo(struct t1 *arg, struct t2 *arg2);