[PATCH] D45516: [ELF] - Refactor lazy symbol duplicated code.
Rafael Avila de Espindola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 11 17:18:41 PDT 2018
espindola added inline comments.
================
Comment at: ELF/SymbolTable.cpp:601
const object::Archive::Symbol Sym) {
- Symbol *S;
- bool WasInserted;
- std::tie(S, WasInserted) = insert(Name);
- if (WasInserted) {
- replaceSymbol<LazyArchive>(S, F, Sym, Symbol::UnknownType);
- return;
- }
- if (!S->isUndefined())
- return;
+ auto ReplaceFn = [&](Symbol *S, uint8_t Type) {
+ replaceSymbol<LazyArchive>(S, F, Sym, Type);
----------------
You can move this definition to the only use:
replaceOrIgnoreLazy(Name, [&]....)
================
Comment at: ELF/SymbolTable.cpp:623
+// with Replace or should be ignored.
+bool SymbolTable::replaceOrIgnoreLazy(StringRef Name, ReplaceFn Replace) {
Symbol *S;
----------------
Can this be a static helper?
================
Comment at: ELF/SymbolTable.h:101
+ using ReplaceFn = llvm::function_ref<void(Symbol *S, uint8_t Type)>;
+ bool replaceOrIgnoreLazy(StringRef Name, ReplaceFn Replace);
+
----------------
Add a comment saying what replaceOrIgnoreLazy does.
https://reviews.llvm.org/D45516
More information about the llvm-commits
mailing list