[PATCH] D45516: [ELF] - Refactor lazy symbol duplicated code.

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 09:28:58 PDT 2018


espindola added inline comments.


================
Comment at: ELF/SymbolTable.cpp:608
   if (WasInserted) {
-    replaceSymbol<LazyArchive>(S, F, Sym, Symbol::UnknownType);
+    Replace(S, Symbol::UnknownType);
     return;
----------------
If you change the argument order in the constructors to:

  LazyArchive(InputFile &File, uint8_t Type,
              const llvm::object::Archive::Symbol S)

and

  LazyObject(InputFile &File, uint8_t Type, StringRef Name)

then it is fairly easy to make replaceOrFetchLazy a variadic template in the same way that replaceSymbol is. That would save one callback argument.


================
Comment at: ELF/SymbolTable.cpp:621
   }
-  if (InputFile *File = F.fetch(Sym))
-    addFile<ELFT>(File);
+  Fetch(S);
 }
----------------
The implementations of Fetch are not using S. Also, if you template this over ELFT you can write

  if (InputFile *File = Fetch())
    Symtab->addFile<ELFT>(File);

And the lambdas are a lot simpler.


https://reviews.llvm.org/D45516





More information about the llvm-commits mailing list