[llvm-branch-commits] [llvm] cc91efd - [llvm-readobj] - An attempt to fix BB.

Georgii Rymar via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 12 02:14:55 PST 2021


Author: Georgii Rymar
Date: 2021-01-12T13:09:49+03:00
New Revision: cc91efdabee05f749cb42e45aef1b45431844ade

URL: https://github.com/llvm/llvm-project/commit/cc91efdabee05f749cb42e45aef1b45431844ade
DIFF: https://github.com/llvm/llvm-project/commit/cc91efdabee05f749cb42e45aef1b45431844ade.diff

LOG: [llvm-readobj] - An attempt to fix BB.

This adds the `template` keyword for 'getAsArrayRef' calls.

An example of error:
/b/1/openmp-gcc-x86_64-linux-debian/llvm.src/llvm/tools/llvm-readobj/ELFDumper.cpp:4491:50: error: use 'template' keyword to treat 'getAsArrayRef' as a dependent template name
    for (const Elf_Rel &Rel : this->DynRelRegion.getAsArrayRef<Elf_Rel>())

Added: 
    

Modified: 
    llvm/tools/llvm-readobj/ELFDumper.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 44608b8c9a06..d18e1d416278 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -265,7 +265,7 @@ template <typename ELFT> class ELFDumper : public ObjDumper {
     // with a DT_NULL entry. However, sometimes the section content may
     // continue past the DT_NULL entry, so to dump the section correctly,
     // we first find the end of the entries by iterating over them.
-    Elf_Dyn_Range Table = DynamicTable.getAsArrayRef<Elf_Dyn>();
+    Elf_Dyn_Range Table = DynamicTable.template getAsArrayRef<Elf_Dyn>();
 
     size_t Size = 0;
     while (Size < Table.size())
@@ -278,7 +278,7 @@ template <typename ELFT> class ELFDumper : public ObjDumper {
   Elf_Sym_Range dynamic_symbols() const {
     if (!DynSymRegion)
       return Elf_Sym_Range();
-    return DynSymRegion->getAsArrayRef<Elf_Sym>();
+    return DynSymRegion->template getAsArrayRef<Elf_Sym>();
   }
 
   const Elf_Shdr *findSectionByName(StringRef Name) const;
@@ -1828,7 +1828,7 @@ void ELFDumper<ELFT>::loadDynamicTable() {
                                   sizeof(Elf_Dyn)));
     FromPhdr.SizePrintName = "PT_DYNAMIC size";
     FromPhdr.EntSizePrintName = "";
-    IsPhdrTableValid = !FromPhdr.getAsArrayRef<Elf_Dyn>().empty();
+    IsPhdrTableValid = !FromPhdr.template getAsArrayRef<Elf_Dyn>().empty();
   }
 
   // Locate the dynamic table described in a section header.
@@ -1844,7 +1844,7 @@ void ELFDumper<ELFT>::loadDynamicTable() {
       FromSec = *RegOrErr;
       FromSec.Context = describe(*DynamicSec);
       FromSec.EntSizePrintName = "";
-      IsSecTableValid = !FromSec.getAsArrayRef<Elf_Dyn>().empty();
+      IsSecTableValid = !FromSec.template getAsArrayRef<Elf_Dyn>().empty();
     } else {
       reportUniqueWarning("unable to read the dynamic table from " +
                           describe(*DynamicSec) + ": " +
@@ -2584,7 +2584,7 @@ getGnuHashTableChains(Optional<DynRegionInfo> DynSymRegion,
     return createError("no dynamic symbol table found");
 
   ArrayRef<typename ELFT::Sym> DynSymTable =
-      DynSymRegion->getAsArrayRef<typename ELFT::Sym>();
+      DynSymRegion->template getAsArrayRef<typename ELFT::Sym>();
   size_t NumSyms = DynSymTable.size();
   if (!NumSyms)
     return createError("the dynamic symbol table is empty");
@@ -4480,21 +4480,24 @@ void ELFDumper<ELFT>::printRelocationsHelper(const Elf_Shdr &Sec) {
 
 template <class ELFT> void ELFDumper<ELFT>::printDynamicRelocationsHelper() {
   const bool IsMips64EL = this->Obj.isMips64EL();
-  if ( this->DynRelaRegion.Size > 0) {
-    printDynamicRelocHeader(ELF::SHT_RELA, "RELA",  this->DynRelaRegion);
-    for (const Elf_Rela &Rela : this->DynRelaRegion.getAsArrayRef<Elf_Rela>())
+  if (this->DynRelaRegion.Size > 0) {
+    printDynamicRelocHeader(ELF::SHT_RELA, "RELA", this->DynRelaRegion);
+    for (const Elf_Rela &Rela :
+         this->DynRelaRegion.template getAsArrayRef<Elf_Rela>())
       printDynamicReloc(Relocation<ELFT>(Rela, IsMips64EL));
   }
 
   if (this->DynRelRegion.Size > 0) {
     printDynamicRelocHeader(ELF::SHT_REL, "REL", this->DynRelRegion);
-    for (const Elf_Rel &Rel : this->DynRelRegion.getAsArrayRef<Elf_Rel>())
+    for (const Elf_Rel &Rel :
+         this->DynRelRegion.template getAsArrayRef<Elf_Rel>())
       printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL));
   }
 
   if (this->DynRelrRegion.Size > 0) {
     printDynamicRelocHeader(ELF::SHT_REL, "RELR", this->DynRelrRegion);
-    Elf_Relr_Range Relrs = this->DynRelrRegion.getAsArrayRef<Elf_Relr>();
+    Elf_Relr_Range Relrs =
+        this->DynRelrRegion.template getAsArrayRef<Elf_Relr>();
     for (const Elf_Rel &Rel : Obj.decode_relrs(Relrs))
       printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL));
   }
@@ -4503,11 +4506,12 @@ template <class ELFT> void ELFDumper<ELFT>::printDynamicRelocationsHelper() {
     if (this->DynPLTRelRegion.EntSize == sizeof(Elf_Rela)) {
       printDynamicRelocHeader(ELF::SHT_RELA, "PLT", this->DynPLTRelRegion);
       for (const Elf_Rela &Rela :
-           this->DynPLTRelRegion.getAsArrayRef<Elf_Rela>())
+           this->DynPLTRelRegion.template getAsArrayRef<Elf_Rela>())
         printDynamicReloc(Relocation<ELFT>(Rela, IsMips64EL));
     } else {
       printDynamicRelocHeader(ELF::SHT_REL, "PLT", this->DynPLTRelRegion);
-      for (const Elf_Rel &Rel : this->DynPLTRelRegion.getAsArrayRef<Elf_Rel>())
+      for (const Elf_Rel &Rel :
+           this->DynPLTRelRegion.template getAsArrayRef<Elf_Rel>())
         printDynamicReloc(Relocation<ELFT>(Rel, IsMips64EL));
     }
   }


        


More information about the llvm-branch-commits mailing list