[NFC][BPF] fix comments and rename functions related to BTF_KIND_DECL_TAG
authorYonghong Song <yhs@fb.com>
Mon, 18 Oct 2021 17:35:14 +0000 (10:35 -0700)
committerYonghong Song <yhs@fb.com>
Mon, 18 Oct 2021 17:43:45 +0000 (10:43 -0700)
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).

llvm/lib/Target/BPF/BTF.h
llvm/lib/Target/BPF/BTFDebug.cpp
llvm/lib/Target/BPF/BTFDebug.h

index 59ba982..95a6460 100644 (file)
@@ -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.
index 2333975..738d472 100644 (file)
@@ -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();
index 30f9d9a..9e0203f 100644 (file)
@@ -204,7 +204,7 @@ public:
   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,