[lld] r296510 - Use make<> instead of new (BAlloc). NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 11:36:30 PST 2017


Author: ruiu
Date: Tue Feb 28 13:36:30 2017
New Revision: 296510

URL: http://llvm.org/viewvc/llvm-project?rev=296510&view=rev
Log:
Use make<> instead of new (BAlloc). NFC.

We converted them before, but there were a few remaining occurrences.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/SymbolTable.cpp
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=296510&r1=296509&r2=296510&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Feb 28 13:36:30 2017
@@ -511,11 +511,10 @@ SymbolBody *elf::ObjectFile<ELFT>::creat
 
     StringRefZ Name = this->StringTable.data() + Sym->st_name;
     if (Sym->st_shndx == SHN_UNDEF)
-      return new (BAlloc)
-          Undefined(Name, /*IsLocal=*/true, StOther, Type, this);
+      return make<Undefined>(Name, /*IsLocal=*/true, StOther, Type, this);
 
-    return new (BAlloc) DefinedRegular(Name, /*IsLocal=*/true, StOther, Type,
-                                       Value, Size, Sec, this);
+    return make<DefinedRegular>(Name, /*IsLocal=*/true, StOther, Type, Value,
+                                Size, Sec, this);
   }
 
   StringRef Name = check(Sym->getName(this->StringTable));

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=296510&r1=296509&r2=296510&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Feb 28 13:36:30 2017
@@ -191,7 +191,7 @@ std::pair<Symbol *, bool> SymbolTable<EL
 
   Symbol *Sym;
   if (IsNew) {
-    Sym = new (BAlloc) Symbol;
+    Sym = make<Symbol>();
     Sym->InVersionScript = false;
     Sym->Binding = STB_WEAK;
     Sym->Visibility = STV_DEFAULT;

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=296510&r1=296509&r2=296510&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Feb 28 13:36:30 2017
@@ -533,11 +533,11 @@ template <class ELFT> void Writer<ELFT>:
     if (!IS || isa<SyntheticSection>(IS) || IS->Type == SHT_REL ||
         IS->Type == SHT_RELA)
       continue;
-    auto *B = new (BAlloc)
-        DefinedRegular("", /*IsLocal=*/true, /*StOther*/ 0, STT_SECTION,
-                       /*Value*/ 0, /*Size*/ 0, IS, nullptr);
 
-    In<ELFT>::SymTab->addSymbol(B);
+    auto *Sym =
+        make<DefinedRegular>("", /*IsLocal=*/true, /*StOther=*/0, STT_SECTION,
+                             /*Value=*/0, /*Size=*/0, IS, nullptr);
+    In<ELFT>::SymTab->addSymbol(Sym);
   }
 }
 




More information about the llvm-commits mailing list