[lld] 4129890 - [ELF] De-template Symbol::resolveLazy. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 24 12:20:09 PST 2022
Author: Fangrui Song
Date: 2022-02-24T12:20:05-08:00
New Revision: 4129890dd88b45280a1219adcaf0e6522a088563
URL: https://github.com/llvm/llvm-project/commit/4129890dd88b45280a1219adcaf0e6522a088563
DIFF: https://github.com/llvm/llvm-project/commit/4129890dd88b45280a1219adcaf0e6522a088563.diff
LOG: [ELF] De-template Symbol::resolveLazy. NFC
Added:
Modified:
lld/ELF/Symbols.cpp
lld/ELF/Symbols.h
Removed:
################################################################################
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 6bf63c25225ef..e361cce664c66 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -650,20 +650,15 @@ void Symbol::resolveDefined(const Defined &other) {
replace(other);
}
-template <class LazyT>
-static void replaceCommon(Symbol &oldSym, const LazyT &newSym) {
- backwardReferences.erase(&oldSym);
- oldSym.replace(newSym);
- newSym.extract();
-}
-
-template <class LazyT> void Symbol::resolveLazy(const LazyT &other) {
+void Symbol::resolveLazy(const LazyObject &other) {
// For common objects, we want to look for global or weak definitions that
// should be extracted as the canonical definition instead.
if (isCommon() && elf::config->fortranCommon) {
if (auto *loSym = dyn_cast<LazyObject>(&other)) {
if (loSym->file->shouldExtractForCommon(getName())) {
- replaceCommon(*this, other);
+ backwardReferences.erase(this);
+ replace(other);
+ other.extract();
return;
}
}
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index 1a6cc9f12a2de..be4eb49d34a95 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -36,6 +36,7 @@ class InputSectionBase;
class SharedSymbol;
class Symbol;
class Undefined;
+class LazyObject;
class InputFile;
// Some index properties of a symbol are stored separately in this auxiliary
@@ -224,7 +225,7 @@ class Symbol {
void resolveUndefined(const Undefined &other);
void resolveCommon(const CommonSymbol &other);
void resolveDefined(const Defined &other);
- template <class LazyT> void resolveLazy(const LazyT &other);
+ void resolveLazy(const LazyObject &other);
void resolveShared(const SharedSymbol &other);
int compare(const Symbol *other) const;
More information about the llvm-commits
mailing list