Skip to content

Commit a162b67

Browse files
committed
[Clang][Attr] rename btf_tag to btf_decl_tag
Current btf_tag is applied to declaration only. Per discussion in https://reviews.llvm.org/D111199, we plan to introduce btf_type_tag attribute for types. So rename btf_tag to btf_decl_tag to make it easily differentiable from btf_type_tag. Differential Revision: https://reviews.llvm.org/D111588
1 parent ef64361 commit a162b67

16 files changed

+75
-75
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,11 +1836,11 @@ def BPFPreserveAccessIndex : InheritableAttr,
18361836
let LangOpts = [COnly];
18371837
}
18381838

1839-
def BTFTag : InheritableAttr {
1840-
let Spellings = [Clang<"btf_tag">];
1841-
let Args = [StringArgument<"BTFTag">];
1839+
def BTFDeclTag : InheritableAttr {
1840+
let Spellings = [Clang<"btf_decl_tag">];
1841+
let Args = [StringArgument<"BTFDeclTag">];
18421842
let Subjects = SubjectList<[Var, Function, Record, Field], ErrorDiag>;
1843-
let Documentation = [BTFTagDocs];
1843+
let Documentation = [BTFDeclTagDocs];
18441844
let LangOpts = [COnly];
18451845
}
18461846

clang/include/clang/Basic/AttrDocs.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,12 +2011,12 @@ preserving struct or union member access debuginfo indices of this
20112011
struct or union, similar to clang ``__builtin_preserve_access_index()``.
20122012
}];
20132013
}
2014-
def BTFTagDocs : Documentation {
2014+
def BTFDeclTagDocs : Documentation {
20152015
let Category = DocCatFunction;
20162016
let Content = [{
2017-
Clang supports the ``__attribute__((btf_tag("ARGUMENT")))`` attribute for all
2018-
targets. This attribute may be attached to a struct/union, struct/union field,
2019-
function, function parameter or variable declaration. If -g is specified,
2017+
Clang supports the ``__attribute__((btf_decl_tag("ARGUMENT")))`` attribute for
2018+
all targets. This attribute may be attached to a struct/union, struct/union
2019+
field, function, function parameter or variable declaration. If -g is specified,
20202020
the ``ARGUMENT`` info will be preserved in IR and be emitted to dwarf.
20212021
For BPF targets, the ``ARGUMENT`` info will be emitted to .BTF ELF section too.
20222022
}];

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3390,7 +3390,7 @@ class Sema final {
33903390
EnforceTCBAttr *mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL);
33913391
EnforceTCBLeafAttr *mergeEnforceTCBLeafAttr(Decl *D,
33923392
const EnforceTCBLeafAttr &AL);
3393-
BTFTagAttr *mergeBTFTagAttr(Decl *D, const BTFTagAttr &AL);
3393+
BTFDeclTagAttr *mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL);
33943394

33953395
void mergeDeclAttributes(NamedDecl *New, Decl *Old,
33963396
AvailabilityMergeKind AMK = AMK_Redeclaration);

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ llvm::DIType *CGDebugInfo::createBitFieldType(const FieldDecl *BitFieldDecl,
14241424
Offset = BitFieldInfo.StorageSize - BitFieldInfo.Size - Offset;
14251425
uint64_t OffsetInBits = StorageOffsetInBits + Offset;
14261426
llvm::DINode::DIFlags Flags = getAccessFlag(BitFieldDecl->getAccess(), RD);
1427-
llvm::DINodeArray Annotations = CollectBTFTagAnnotations(BitFieldDecl);
1427+
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(BitFieldDecl);
14281428
return DBuilder.createBitFieldMemberType(
14291429
RecordTy, Name, File, Line, SizeInBits, OffsetInBits, StorageOffsetInBits,
14301430
Flags, DebugType, Annotations);
@@ -1541,7 +1541,7 @@ void CGDebugInfo::CollectRecordNormalField(
15411541
FieldType = createBitFieldType(field, RecordTy, RD);
15421542
} else {
15431543
auto Align = getDeclAlignIfRequired(field, CGM.getContext());
1544-
llvm::DINodeArray Annotations = CollectBTFTagAnnotations(field);
1544+
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(field);
15451545
FieldType =
15461546
createFieldType(name, type, field->getLocation(), field->getAccess(),
15471547
OffsetInBits, Align, tunit, RecordTy, RD, Annotations);
@@ -2141,15 +2141,15 @@ llvm::DINodeArray CGDebugInfo::CollectCXXTemplateParams(const RecordDecl *RD,
21412141
return CollectTemplateParams(GetTemplateArgs(RD), Unit);
21422142
}
21432143

2144-
llvm::DINodeArray CGDebugInfo::CollectBTFTagAnnotations(const Decl *D) {
2145-
if (!D->hasAttr<BTFTagAttr>())
2144+
llvm::DINodeArray CGDebugInfo::CollectBTFDeclTagAnnotations(const Decl *D) {
2145+
if (!D->hasAttr<BTFDeclTagAttr>())
21462146
return nullptr;
21472147

21482148
SmallVector<llvm::Metadata *, 4> Annotations;
2149-
for (const auto *I : D->specific_attrs<BTFTagAttr>()) {
2149+
for (const auto *I : D->specific_attrs<BTFDeclTagAttr>()) {
21502150
llvm::Metadata *Ops[2] = {
2151-
llvm::MDString::get(CGM.getLLVMContext(), StringRef("btf_tag")),
2152-
llvm::MDString::get(CGM.getLLVMContext(), I->getBTFTag())};
2151+
llvm::MDString::get(CGM.getLLVMContext(), StringRef("btf_decl_tag")),
2152+
llvm::MDString::get(CGM.getLLVMContext(), I->getBTFDeclTag())};
21532153
Annotations.push_back(llvm::MDNode::get(CGM.getLLVMContext(), Ops));
21542154
}
21552155
return DBuilder.getOrCreateArray(Annotations);
@@ -3527,7 +3527,7 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
35273527
Flags |= llvm::DINode::FlagExportSymbols;
35283528
}
35293529

3530-
llvm::DINodeArray Annotations = CollectBTFTagAnnotations(D);
3530+
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D);
35313531
llvm::DICompositeType *RealDecl = DBuilder.createReplaceableCompositeType(
35323532
getTagForRecord(RD), RDName, RDContext, DefUnit, Line, 0, Size, Align,
35333533
Flags, Identifier, Annotations);
@@ -4047,7 +4047,7 @@ void CGDebugInfo::emitFunctionStart(GlobalDecl GD, SourceLocation Loc,
40474047
Decl = isa<ObjCMethodDecl>(D)
40484048
? getObjCMethodDeclaration(D, DIFnType, LineNo, Flags, SPFlags)
40494049
: getFunctionDeclaration(D);
4050-
Annotations = CollectBTFTagAnnotations(D);
4050+
Annotations = CollectBTFDeclTagAnnotations(D);
40514051
}
40524052

40534053
// FIXME: The function declaration we're constructing here is mostly reusing
@@ -4117,7 +4117,7 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
41174117
if (CGM.getLangOpts().Optimize)
41184118
SPFlags |= llvm::DISubprogram::SPFlagOptimized;
41194119

4120-
llvm::DINodeArray Annotations = CollectBTFTagAnnotations(D);
4120+
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D);
41214121
llvm::DISubprogram *SP = DBuilder.createFunction(
41224122
FDContext, Name, LinkageName, Unit, LineNo,
41234123
getOrCreateFunctionType(D, FnType, Unit), ScopeLine, Flags, SPFlags,
@@ -4458,7 +4458,7 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const VarDecl *VD,
44584458
// Create the descriptor for the variable.
44594459
llvm::DILocalVariable *D = nullptr;
44604460
if (ArgNo) {
4461-
llvm::DINodeArray Annotations = CollectBTFTagAnnotations(VD);
4461+
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(VD);
44624462
D = DBuilder.createParameterVariable(Scope, Name, *ArgNo, Unit, Line, Ty,
44634463
CGM.getLangOpts().Optimize, Flags,
44644464
Annotations);
@@ -5079,7 +5079,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
50795079
}
50805080
AppendAddressSpaceXDeref(AddressSpace, Expr);
50815081

5082-
llvm::DINodeArray Annotations = CollectBTFTagAnnotations(D);
5082+
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations(D);
50835083
GVE = DBuilder.createGlobalVariableExpression(
50845084
DContext, DeclName, LinkageName, Unit, LineNo, getOrCreateType(T, Unit),
50855085
Var->hasLocalLinkage(), true,

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ class CGDebugInfo {
300300
llvm::DINodeArray CollectCXXTemplateParams(const RecordDecl *TS,
301301
llvm::DIFile *F);
302302

303-
/// A helper function to collect debug info for btf_tag annotations.
304-
llvm::DINodeArray CollectBTFTagAnnotations(const Decl *D);
303+
/// A helper function to collect debug info for btf_decl_tag annotations.
304+
llvm::DINodeArray CollectBTFDeclTagAnnotations(const Decl *D);
305305

306306
llvm::DIType *createFieldType(StringRef name, QualType type,
307307
SourceLocation loc, AccessSpecifier AS,

clang/lib/Sema/SemaDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,8 +2679,8 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D,
26792679
NewAttr = S.mergeEnforceTCBAttr(D, *TCBA);
26802680
else if (const auto *TCBLA = dyn_cast<EnforceTCBLeafAttr>(Attr))
26812681
NewAttr = S.mergeEnforceTCBLeafAttr(D, *TCBLA);
2682-
else if (const auto *BTFA = dyn_cast<BTFTagAttr>(Attr))
2683-
NewAttr = S.mergeBTFTagAttr(D, *BTFA);
2682+
else if (const auto *BTFA = dyn_cast<BTFDeclTagAttr>(Attr))
2683+
NewAttr = S.mergeBTFDeclTagAttr(D, *BTFA);
26842684
else if (Attr->shouldInheritEvenIfAlreadyPresent() || !DeclHasAttr(D, Attr))
26852685
NewAttr = cast<InheritableAttr>(Attr->clone(S.Context));
26862686

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6887,28 +6887,28 @@ static void handleBPFPreserveAccessIndexAttr(Sema &S, Decl *D,
68876887
Rec->addAttr(::new (S.Context) BPFPreserveAccessIndexAttr(S.Context, AL));
68886888
}
68896889

6890-
static bool hasBTFTagAttr(Decl *D, StringRef Tag) {
6891-
for (const auto *I : D->specific_attrs<BTFTagAttr>()) {
6892-
if (I->getBTFTag() == Tag)
6890+
static bool hasBTFDeclTagAttr(Decl *D, StringRef Tag) {
6891+
for (const auto *I : D->specific_attrs<BTFDeclTagAttr>()) {
6892+
if (I->getBTFDeclTag() == Tag)
68936893
return true;
68946894
}
68956895
return false;
68966896
}
68976897

6898-
static void handleBTFTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
6898+
static void handleBTFDeclTagAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
68996899
StringRef Str;
69006900
if (!S.checkStringLiteralArgumentAttr(AL, 0, Str))
69016901
return;
6902-
if (hasBTFTagAttr(D, Str))
6902+
if (hasBTFDeclTagAttr(D, Str))
69036903
return;
69046904

6905-
D->addAttr(::new (S.Context) BTFTagAttr(S.Context, AL, Str));
6905+
D->addAttr(::new (S.Context) BTFDeclTagAttr(S.Context, AL, Str));
69066906
}
69076907

6908-
BTFTagAttr *Sema::mergeBTFTagAttr(Decl *D, const BTFTagAttr &AL) {
6909-
if (hasBTFTagAttr(D, AL.getBTFTag()))
6908+
BTFDeclTagAttr *Sema::mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL) {
6909+
if (hasBTFDeclTagAttr(D, AL.getBTFDeclTag()))
69106910
return nullptr;
6911-
return ::new (Context) BTFTagAttr(Context, AL, AL.getBTFTag());
6911+
return ::new (Context) BTFDeclTagAttr(Context, AL, AL.getBTFDeclTag());
69126912
}
69136913

69146914
static void handleWebAssemblyExportNameAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
@@ -7947,8 +7947,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
79477947
case ParsedAttr::AT_BPFPreserveAccessIndex:
79487948
handleBPFPreserveAccessIndexAttr(S, D, AL);
79497949
break;
7950-
case ParsedAttr::AT_BTFTag:
7951-
handleBTFTagAttr(S, D, AL);
7950+
case ParsedAttr::AT_BTFDeclTag:
7951+
handleBTFDeclTagAttr(S, D, AL);
79527952
break;
79537953
case ParsedAttr::AT_WebAssemblyExportName:
79547954
handleWebAssemblyExportNameAttr(S, D, AL);

clang/test/CodeGen/attr-btf_tag-dicomposite-2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s
33

4-
#define __tag1 __attribute__((btf_tag("tag1")))
5-
#define __tag2 __attribute__((btf_tag("tag2")))
4+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
5+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
66

77
struct __tag1 __tag2 t1;
88

clang/test/CodeGen/attr-btf_tag-dicomposite.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s
33

4-
#define __tag1 __attribute__((btf_tag("tag1")))
5-
#define __tag2 __attribute__((btf_tag("tag2")))
4+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
5+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
66

77
struct __tag1 __tag2 t1;
88
struct t1 {
@@ -15,8 +15,8 @@ int foo(struct t1 *arg) {
1515

1616
// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", file: ![[#]], line: [[#]], size: 32, elements: ![[#]], annotations: ![[ANNOT:[0-9]+]])
1717
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
18-
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
19-
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
18+
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
19+
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
2020

2121
struct __tag1 t2;
2222
struct __tag2 t2 {

clang/test/CodeGen/attr-btf_tag-diglobalvariable.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s
33

4-
#define __tag1 __attribute__((btf_tag("tag1")))
5-
#define __tag2 __attribute__((btf_tag("tag2")))
4+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
5+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
66

77
struct t1 {
88
int a;
@@ -15,8 +15,8 @@ struct t1 g2;
1515
// CHECK: distinct !DIGlobalVariable(name: "g1", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT:[0-9]+]])
1616
// CHECK: distinct !DIGlobalVariable(name: "g2", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], isLocal: false, isDefinition: true, annotations: ![[ANNOT]])
1717
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
18-
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
19-
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
18+
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
19+
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
2020

2121
extern struct t1 g3 __tag1;
2222
struct t1 g3 __tag2;

clang/test/CodeGen/attr-btf_tag-disubprogram-callsite.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22
// RUN: %clang -target x86_64 -g -S -O2 -emit-llvm -o - %s | FileCheck %s
33

4-
#define __tag1 __attribute__((btf_tag("tag1")))
5-
#define __tag2 __attribute__((btf_tag("tag2")))
4+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
5+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
66

77
struct t1 {
88
int a;
@@ -15,5 +15,5 @@ int foo2(struct t1 *arg) {
1515

1616
// CHECK: ![[#]] = !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]])
1717
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
18-
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
19-
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
18+
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
19+
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}

clang/test/CodeGen/attr-btf_tag-disubprogram.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s
33

4-
#define __tag1 __attribute__((btf_tag("tag1")))
5-
#define __tag2 __attribute__((btf_tag("tag2")))
4+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
5+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
66

77
struct t1 {
88
int a;
@@ -14,8 +14,8 @@ int __tag1 __tag2 foo(struct t1 *arg) {
1414

1515
// CHECK: distinct !DISubprogram(name: "foo", scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], scopeLine: [[#]], flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: ![[#]], retainedNodes: ![[#]], annotations: ![[ANNOT:[0-9]+]])
1616
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
17-
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
18-
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
17+
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
18+
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
1919

2020
int __tag1 __tag2 foo2(struct t1 *arg);
2121
int foo2(struct t1 *arg) {

clang/test/CodeGen/attr-btf_tag-field.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s
33

4-
#define __tag1 __attribute__((btf_tag("tag1")))
5-
#define __tag2 __attribute__((btf_tag("tag2")))
4+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
5+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
66

77
struct t1 {
88
int a __tag1 __tag2;
@@ -21,7 +21,7 @@ int foo2(struct t2 *arg) {
2121
}
2222
// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 32, annotations: ![[ANNOT:[0-9]+]])
2323
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
24-
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
25-
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
24+
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
25+
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}
2626

2727
// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b", scope: ![[#]], file: ![[#]], line: [[#]], baseType: ![[#]], size: 1, flags: DIFlagBitField, extraData: i64 0, annotations: ![[ANNOT]])
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// REQUIRES: x86-registered-target
22
// RUN: %clang -target x86_64 -g -S -emit-llvm -o - %s | FileCheck %s
33

4-
#define __tag1 __attribute__((btf_tag("tag1")))
5-
#define __tag2 __attribute__((btf_tag("tag2")))
4+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
5+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
66

77
struct t1 {
88
int a;
@@ -14,5 +14,5 @@ int foo(struct t1 __tag1 __tag2 *arg) {
1414

1515
// CHECK: !DILocalVariable(name: "arg", arg: 1, scope: ![[#]], file: ![[#]], line: [[#]], type: ![[#]], annotations: ![[ANNOT:[0-9]+]])
1616
// CHECK: ![[ANNOT]] = !{![[TAG1:[0-9]+]], ![[TAG2:[0-9]+]]}
17-
// CHECK: ![[TAG1]] = !{!"btf_tag", !"tag1"}
18-
// CHECK: ![[TAG2]] = !{!"btf_tag", !"tag2"}
17+
// CHECK: ![[TAG1]] = !{!"btf_decl_tag", !"tag1"}
18+
// CHECK: ![[TAG2]] = !{!"btf_decl_tag", !"tag2"}

clang/test/Misc/pragma-attribute-supported-attributes-list.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// CHECK-NEXT: Assumption (SubjectMatchRule_function, SubjectMatchRule_objc_method)
2323
// 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))
2424
// CHECK-NEXT: BPFPreserveAccessIndex (SubjectMatchRule_record)
25-
// CHECK-NEXT: BTFTag (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record, SubjectMatchRule_field)
25+
// CHECK-NEXT: BTFDeclTag (SubjectMatchRule_variable, SubjectMatchRule_function, SubjectMatchRule_record, SubjectMatchRule_field)
2626
// CHECK-NEXT: BuiltinAlias (SubjectMatchRule_function)
2727
// CHECK-NEXT: CFAuditedTransfer (SubjectMatchRule_function)
2828
// CHECK-NEXT: CFConsumed (SubjectMatchRule_variable_is_parameter)

clang/test/Sema/attr-btf_tag.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %clang_cc1 -x c -triple x86_64-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s
22

3-
#define __tag1 __attribute__((btf_tag("tag1")))
4-
#define __tag2 __attribute__((btf_tag("tag2")))
5-
#define __tag3 __attribute__((btf_tag("tag3")))
3+
#define __tag1 __attribute__((btf_decl_tag("tag1")))
4+
#define __tag2 __attribute__((btf_decl_tag("tag2")))
5+
#define __tag3 __attribute__((btf_decl_tag("tag3")))
66

7-
#define __tag_no_arg __attribute__((btf_tag()))
8-
#define __tag_2_arg __attribute__((btf_tag("tag1", "tag2")))
9-
#define __invalid __attribute__((btf_tag(1)))
7+
#define __tag_no_arg __attribute__((btf_decl_tag()))
8+
#define __tag_2_arg __attribute__((btf_decl_tag("tag1", "tag2")))
9+
#define __invalid __attribute__((btf_decl_tag(1)))
1010

1111
struct __tag1 __tag2 t1;
1212
struct t1 {
@@ -19,21 +19,21 @@ struct __tag2 __tag3 t2 {
1919
};
2020

2121
int g1 __tag1;
22-
int g2 __tag_no_arg; // expected-error {{'btf_tag' attribute takes one argument}}
23-
int g3 __tag_2_arg; // expected-error {{'btf_tag' attribute takes one argument}}
24-
int i1 __invalid; // expected-error {{'btf_tag' attribute requires a string}}
22+
int g2 __tag_no_arg; // expected-error {{'btf_decl_tag' attribute takes one argument}}
23+
int g3 __tag_2_arg; // expected-error {{'btf_decl_tag' attribute takes one argument}}
24+
int i1 __invalid; // expected-error {{'btf_decl_tag' attribute requires a string}}
2525

2626
enum e1 {
2727
E1
28-
} __tag1; // expected-error {{'btf_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}}
28+
} __tag1; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}}
2929

3030
enum e2 {
3131
E2
32-
} __tag_no_arg; // expected-error {{'btf_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}}
32+
} __tag_no_arg; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}}
3333

3434
enum e3 {
3535
E3
36-
} __tag_2_arg; // expected-error {{'btf_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}}
36+
} __tag_2_arg; // expected-error {{'btf_decl_tag' attribute only applies to variables, functions, structs, unions, classes, and non-static data members}}
3737

3838
int __tag1 __tag2 foo(struct t1 *arg, struct t2 *arg2);
3939
int __tag2 __tag3 foo(struct t1 *arg, struct t2 *arg2);

0 commit comments

Comments
 (0)