[lld] r321185 - Use a reference for a value that is never null. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 08:16:40 PST 2017


Author: rafael
Date: Wed Dec 20 08:16:40 2017
New Revision: 321185

URL: http://llvm.org/viewvc/llvm-project?rev=321185&view=rev
Log:
Use a reference for a value that is never null. NFC.

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

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=321185&r1=321184&r2=321185&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Wed Dec 20 08:16:40 2017
@@ -925,7 +925,7 @@ static uint8_t mapVisibility(GlobalValue
 template <class ELFT>
 static Symbol *createBitcodeSymbol(const std::vector<bool> &KeptComdats,
                                    const lto::InputFile::Symbol &ObjSym,
-                                   BitcodeFile *F) {
+                                   BitcodeFile &F) {
   StringRef NameRef = Saver.save(ObjSym.getName());
   uint32_t Binding = ObjSym.isWeak() ? STB_WEAK : STB_GLOBAL;
 
@@ -936,16 +936,16 @@ static Symbol *createBitcodeSymbol(const
   int C = ObjSym.getComdatIndex();
   if (C != -1 && !KeptComdats[C])
     return Symtab->addUndefined<ELFT>(NameRef, Binding, Visibility, Type,
-                                      CanOmitFromDynSym, F);
+                                      CanOmitFromDynSym, &F);
 
   if (ObjSym.isUndefined())
     return Symtab->addUndefined<ELFT>(NameRef, Binding, Visibility, Type,
-                                      CanOmitFromDynSym, F);
+                                      CanOmitFromDynSym, &F);
 
   if (ObjSym.isCommon())
     return Symtab->addCommon(NameRef, ObjSym.getCommonSize(),
                              ObjSym.getCommonAlignment(), Binding, Visibility,
-                             STT_OBJECT, F);
+                             STT_OBJECT, &F);
 
   return Symtab->addBitcode(NameRef, Binding, Visibility, Type,
                             CanOmitFromDynSym, F);
@@ -958,7 +958,7 @@ void BitcodeFile::parse(DenseSet<CachedH
     KeptComdats.push_back(ComdatGroups.insert(CachedHashStringRef(S)).second);
 
   for (const lto::InputFile::Symbol &ObjSym : Obj->symbols())
-    Symbols.push_back(createBitcodeSymbol<ELFT>(KeptComdats, ObjSym, this));
+    Symbols.push_back(createBitcodeSymbol<ELFT>(KeptComdats, ObjSym, *this));
 }
 
 static ELFKind getELFKind(MemoryBufferRef MB) {

Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=321185&r1=321184&r2=321185&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Dec 20 08:16:40 2017
@@ -508,17 +508,17 @@ void SymbolTable::addShared(StringRef Na
 
 Symbol *SymbolTable::addBitcode(StringRef Name, uint8_t Binding,
                                 uint8_t StOther, uint8_t Type,
-                                bool CanOmitFromDynSym, BitcodeFile *F) {
+                                bool CanOmitFromDynSym, BitcodeFile &F) {
   Symbol *S;
   bool WasInserted;
   std::tie(S, WasInserted) =
-      insert(Name, Type, getVisibility(StOther), CanOmitFromDynSym, F);
+      insert(Name, Type, getVisibility(StOther), CanOmitFromDynSym, &F);
   int Cmp = compareDefinedNonCommon(S, WasInserted, Binding,
                                     /*IsAbs*/ false, /*Value*/ 0, Name);
   if (Cmp > 0)
-    replaceSymbol<Defined>(S, F, Name, Binding, StOther, Type, 0, 0, nullptr);
+    replaceSymbol<Defined>(S, &F, Name, Binding, StOther, Type, 0, 0, nullptr);
   else if (Cmp == 0)
-    reportDuplicate(S, F);
+    reportDuplicate(S, &F);
   return S;
 }
 

Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=321185&r1=321184&r2=321185&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Wed Dec 20 08:16:40 2017
@@ -68,7 +68,7 @@ public:
   template <class ELFT> void addLazyObject(StringRef Name, LazyObjFile &Obj);
 
   Symbol *addBitcode(StringRef Name, uint8_t Binding, uint8_t StOther,
-                     uint8_t Type, bool CanOmitFromDynSym, BitcodeFile *File);
+                     uint8_t Type, bool CanOmitFromDynSym, BitcodeFile &File);
 
   Symbol *addCommon(StringRef Name, uint64_t Size, uint32_t Alignment,
                     uint8_t Binding, uint8_t StOther, uint8_t Type,




More information about the llvm-commits mailing list