[llvm] f4a8526 - [NFC][BPF] fix comments and rename functions related to BTF_KIND_DECL_TAG
Yonghong Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 18 10:44:22 PDT 2021
Author: Yonghong Song
Date: 2021-10-18T10:43:45-07:00
New Revision: f4a8526cc49f53f86e84b3d0113694c86adacaa8
URL: https://github.com/llvm/llvm-project/commit/f4a8526cc49f53f86e84b3d0113694c86adacaa8
DIFF: https://github.com/llvm/llvm-project/commit/f4a8526cc49f53f86e84b3d0113694c86adacaa8.diff
LOG: [NFC][BPF] fix comments and rename functions related to BTF_KIND_DECL_TAG
There are no functionality change.
Fix some comments and rename processAnnotations() to
processDeclAnnotations() to avoid confusion when later
BTF_KIND_TYPE_TAG is introduced (https://reviews.llvm.org/D111199).
Added:
Modified:
llvm/lib/Target/BPF/BTF.h
llvm/lib/Target/BPF/BTFDebug.cpp
llvm/lib/Target/BPF/BTFDebug.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/BPF/BTF.h b/llvm/lib/Target/BPF/BTF.h
index 59ba982b36b2..95a64609ae38 100644
--- a/llvm/lib/Target/BPF/BTF.h
+++ b/llvm/lib/Target/BPF/BTF.h
@@ -106,7 +106,7 @@ struct CommonType {
/// Bits 24-27: kind (e.g. int, ptr, array...etc)
/// Bits 28-30: unused
/// Bit 31: kind_flag, currently used by
- /// struct, union, fwd and decl_tag
+ /// struct, union and fwd
uint32_t Info;
/// "Size" is used by INT, ENUM, STRUCT and UNION.
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index 233397533511..738d472f6efe 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -497,8 +497,9 @@ void BTFDebug::visitSubroutineType(
}
}
-void BTFDebug::processAnnotations(DINodeArray Annotations, uint32_t BaseTypeId,
- int ComponentIdx) {
+void BTFDebug::processDeclAnnotations(DINodeArray Annotations,
+ uint32_t BaseTypeId,
+ int ComponentIdx) {
if (!Annotations)
return;
@@ -539,14 +540,14 @@ void BTFDebug::visitStructType(const DICompositeType *CTy, bool IsStruct,
TypeId = addType(std::move(TypeEntry), CTy);
// Check struct/union annotations
- processAnnotations(CTy->getAnnotations(), TypeId, -1);
+ processDeclAnnotations(CTy->getAnnotations(), TypeId, -1);
// Visit all struct members.
int FieldNo = 0;
for (const auto *Element : Elements) {
const auto Elem = cast<DIDerivedType>(Element);
visitTypeEntry(Elem);
- processAnnotations(Elem->getAnnotations(), TypeId, FieldNo);
+ processDeclAnnotations(Elem->getAnnotations(), TypeId, FieldNo);
FieldNo++;
}
}
@@ -1017,11 +1018,11 @@ void BTFDebug::beginFunctionImpl(const MachineFunction *MF) {
if (const auto *DV = dyn_cast<DILocalVariable>(DN)) {
uint32_t Arg = DV->getArg();
if (Arg)
- processAnnotations(DV->getAnnotations(), FuncTypeId, Arg - 1);
+ processDeclAnnotations(DV->getAnnotations(), FuncTypeId, Arg - 1);
}
}
- processAnnotations(SP->getAnnotations(), FuncTypeId, -1);
+ processDeclAnnotations(SP->getAnnotations(), FuncTypeId, -1);
for (const auto &TypeEntry : TypeEntries)
TypeEntry->completeType(*this);
@@ -1273,7 +1274,7 @@ void BTFDebug::processGlobals(bool ProcessingMapDef) {
std::make_unique<BTFKindVar>(Global.getName(), GVTypeId, GVarInfo);
uint32_t VarId = addType(std::move(VarEntry));
- processAnnotations(DIGlobal->getAnnotations(), VarId, -1);
+ processDeclAnnotations(DIGlobal->getAnnotations(), VarId, -1);
// An empty SecName means an extern variable without section attribute.
if (SecName.empty())
@@ -1370,7 +1371,7 @@ void BTFDebug::processFuncPrototypes(const Function *F) {
std::make_unique<BTFTypeFunc>(SP->getName(), ProtoTypeId, Scope);
uint32_t FuncId = addType(std::move(FuncTypeEntry));
- processAnnotations(SP->getAnnotations(), FuncId, -1);
+ processDeclAnnotations(SP->getAnnotations(), FuncId, -1);
if (F->hasSection()) {
StringRef SecName = F->getSection();
diff --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h
index 30f9d9abaec9..9e0203f292b2 100644
--- a/llvm/lib/Target/BPF/BTFDebug.h
+++ b/llvm/lib/Target/BPF/BTFDebug.h
@@ -204,7 +204,7 @@ class BTFTypeFloat : public BTFTypeBase {
void completeType(BTFDebug &BDebug) override;
};
-/// Handle tags.
+/// Handle decl tags.
class BTFTypeDeclTag : public BTFTypeBase {
uint32_t Info;
StringRef Tag;
@@ -325,9 +325,9 @@ class BTFDebug : public DebugHandlerBase {
/// Generate types for function prototypes.
void processFuncPrototypes(const Function *);
- /// Generate types for annotations.
- void processAnnotations(DINodeArray Annotations, uint32_t BaseTypeId,
- int ComponentId);
+ /// Generate types for decl annotations.
+ void processDeclAnnotations(DINodeArray Annotations, uint32_t BaseTypeId,
+ int ComponentId);
/// Generate one field relocation record.
void generatePatchImmReloc(const MCSymbol *ORSym, uint32_t RootId,
More information about the llvm-commits
mailing list