[clang] a162b67 - [Clang][Attr] rename btf_tag to btf_decl_tag
Yonghong Song via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 11 22:21:50 PDT 2021
Author: Yonghong Song
Date: 2021-10-11T22:17:17-07:00
New Revision: a162b67c98066218d0d00aa13b99afb95d9bb5e6
URL: https://github.com/llvm/llvm-project/commit/a162b67c98066218d0d00aa13b99afb95d9bb5e6
DIFF: https://github.com/llvm/llvm-project/commit/a162b67c98066218d0d00aa13b99afb95d9bb5e6.diff
LOG: [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
Added:
Modified:
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Sema/Sema.h
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGen/attr-btf_tag-dicomposite-2.c
clang/test/CodeGen/attr-btf_tag-dicomposite.c
clang/test/CodeGen/attr-btf_tag-diglobalvariable.c
clang/test/CodeGen/attr-btf_tag-disubprogram-callsite.c
clang/test/CodeGen/attr-btf_tag-disubprogram.c
clang/test/CodeGen/attr-btf_tag-field.c
clang/test/CodeGen/attr-btf_tag-parameter.c
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/Sema/attr-btf_tag.c
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td
index c39657e6c8351..6d31b2906bc58 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -1836,11 +1836,11 @@ def BPFPreserveAccessIndex : InheritableAttr,
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
index b2b41c3bb4197..3a70f88eff0a2 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -2011,12 +2011,12 @@ preserving struct or union member access debuginfo indices of this
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
index 4d4d01376e0c0..e09803fddd10e 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3390,7 +3390,7 @@ class Sema final {
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.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 9c98278aa6221..dcc838562e825 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1424,7 +1424,7 @@ llvm::DIType *CGDebugInfo::createBitFieldType(const FieldDecl *BitFieldDecl,
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 @@ void CGDebugInfo::CollectRecordNormalField(
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 @@ llvm::DINodeArray CGDebugInfo::CollectCXXTemplateParams(const RecordDecl *RD,
return CollectTemplateParams(GetTemplateArgs(RD), Unit);
}
-llvm::DINodeArray CGDebugInfo::CollectBTFTagAnnotations(const Decl *D) {
- if (!D->hasAttr<BTFTagAttr>())
+llvm::DINodeArray CGDebugInfo::CollectBTFDeclTagAnnotations(const Decl *D) {
+ if (!D->hasAttr<BTFDeclTagAttr>())
return nullptr;
SmallVector<llvm::Metadata *, 4> Annotations;
- for (const auto *I : D->specific_attrs<BTFTagAttr>()) {
+ for (const auto *I : D->specific_attrs<BTFDeclTagAttr>()) {
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 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
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 @@ void CGDebugInfo::emitFunctionStart(GlobalDecl GD, SourceLocation Loc,
Decl = isa<ObjCMethodDecl>(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 @@ void CGDebugInfo::EmitFunctionDecl(GlobalDecl GD, SourceLocation Loc,
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 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const VarDecl *VD,
// 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 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
}
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/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 42bf6cd104c29..d6b9bdd4839cc 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -300,8 +300,8 @@ class CGDebugInfo {
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/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1a8d7cc67a8f8..7fff85a360d67 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2679,8 +2679,8 @@ static bool mergeDeclAttribute(Sema &S, NamedDecl *D,
NewAttr = S.mergeEnforceTCBAttr(D, *TCBA);
else if (const auto *TCBLA = dyn_cast<EnforceTCBLeafAttr>(Attr))
NewAttr = S.mergeEnforceTCBLeafAttr(D, *TCBLA);
- else if (const auto *BTFA = dyn_cast<BTFTagAttr>(Attr))
- NewAttr = S.mergeBTFTagAttr(D, *BTFA);
+ else if (const auto *BTFA = dyn_cast<BTFDeclTagAttr>(Attr))
+ NewAttr = S.mergeBTFDeclTagAttr(D, *BTFA);
else if (Attr->shouldInheritEvenIfAlreadyPresent() || !DeclHasAttr(D, Attr))
NewAttr = cast<InheritableAttr>(Attr->clone(S.Context));
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index d49ff4bb2b416..c01fde8f83759 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -6887,28 +6887,28 @@ static void handleBPFPreserveAccessIndexAttr(Sema &S, Decl *D,
Rec->addAttr(::new (S.Context) BPFPreserveAccessIndexAttr(S.Context, AL));
}
-static bool hasBTFTagAttr(Decl *D, StringRef Tag) {
- for (const auto *I : D->specific_attrs<BTFTagAttr>()) {
- if (I->getBTFTag() == Tag)
+static bool hasBTFDeclTagAttr(Decl *D, StringRef Tag) {
+ for (const auto *I : D->specific_attrs<BTFDeclTagAttr>()) {
+ 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 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
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
index ed937ec28c37a..ff0d517827423 100644
--- 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
index 514dc4e0ccc10..be31d95cc05c8 100644
--- 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 @@ int foo(struct t1 *arg) {
// 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
index e8b20a202990d..3eb8175d93c55 100644
--- 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 @@ struct t1 g2;
// 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
index fcba5dd6d8a17..e3bfd71a56aad 100644
--- 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 @@ int foo2(struct t1 *arg) {
// 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
index 4c22e690f8dfe..86df8220aa5e1 100644
--- 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 @@ int __tag1 __tag2 foo(struct t1 *arg) {
// 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
index 93ba6419b12ec..98791b5b79ecd 100644
--- 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 @@ int foo2(struct t2 *arg) {
}
// 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
index 77ca246f68270..889883b592c75 100644
--- 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 @@ int foo(struct t1 __tag1 __tag2 *arg) {
// 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
index ef08ad89ff8c6..d4cd73f5e9bce 100644
--- 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
index 88452fa875b1a..4f2a5dd57ad93 100644
--- 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 @@ struct __tag2 __tag3 t2 {
};
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);
More information about the cfe-commits
mailing list