[lld] r317383 - Rename replaceBody -> replaceSymbol.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 15:48:47 PDT 2017
Author: ruiu
Date: Fri Nov 3 15:48:47 2017
New Revision: 317383
URL: http://llvm.org/viewvc/llvm-project?rev=317383&view=rev
Log:
Rename replaceBody -> replaceSymbol.
Modified:
lld/trunk/COFF/LTO.cpp
lld/trunk/COFF/SymbolTable.cpp
lld/trunk/COFF/Symbols.h
lld/trunk/COFF/Writer.cpp
lld/trunk/ELF/LTO.cpp
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.h
lld/trunk/ELF/SyntheticSections.cpp
Modified: lld/trunk/COFF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/LTO.cpp?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/COFF/LTO.cpp (original)
+++ lld/trunk/COFF/LTO.cpp Fri Nov 3 15:48:47 2017
@@ -88,7 +88,7 @@ BitcodeCompiler::BitcodeCompiler() : LTO
BitcodeCompiler::~BitcodeCompiler() = default;
-static void undefine(Symbol *S) { replaceBody<Undefined>(S, S->getName()); }
+static void undefine(Symbol *S) { replaceSymbol<Undefined>(S, S->getName()); }
void BitcodeCompiler::add(BitcodeFile &F) {
lto::InputFile &Obj = *F.Obj;
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Fri Nov 3 15:48:47 2017
@@ -126,7 +126,7 @@ void SymbolTable::reportRemainingUndefin
Symbol *Imp = find(Name.substr(strlen("__imp_")));
if (Imp && isa<Defined>(Imp)) {
auto *D = cast<Defined>(Imp);
- replaceBody<DefinedLocalImport>(Sym, Name, D);
+ replaceSymbol<DefinedLocalImport>(Sym, Name, D);
LocalImportChunks.push_back(cast<DefinedLocalImport>(Sym)->getChunk());
continue;
}
@@ -135,7 +135,7 @@ void SymbolTable::reportRemainingUndefin
// Remaining undefined symbols are not fatal if /force is specified.
// They are replaced with dummy defined symbols.
if (Config->Force)
- replaceBody<DefinedAbsolute>(Sym, Name, 0);
+ replaceSymbol<DefinedAbsolute>(Sym, Name, 0);
Undefs.insert(Sym);
}
@@ -170,7 +170,7 @@ Symbol *SymbolTable::addUndefined(String
if (!F || !isa<BitcodeFile>(F))
S->IsUsedInRegularObj = true;
if (WasInserted || (isa<Lazy>(S) && IsWeakAlias)) {
- replaceBody<Undefined>(S, Name);
+ replaceSymbol<Undefined>(S, Name);
return S;
}
if (auto *L = dyn_cast<Lazy>(S)) {
@@ -188,7 +188,7 @@ void SymbolTable::addLazy(ArchiveFile *F
bool WasInserted;
std::tie(S, WasInserted) = insert(Name);
if (WasInserted) {
- replaceBody<Lazy>(S, F, Sym);
+ replaceSymbol<Lazy>(S, F, Sym);
return;
}
auto *U = dyn_cast<Undefined>(S);
@@ -210,7 +210,7 @@ Symbol *SymbolTable::addAbsolute(StringR
std::tie(S, WasInserted) = insert(N);
S->IsUsedInRegularObj = true;
if (WasInserted || isa<Undefined>(S) || isa<Lazy>(S))
- replaceBody<DefinedAbsolute>(S, N, Sym);
+ replaceSymbol<DefinedAbsolute>(S, N, Sym);
else if (!isa<DefinedCOFF>(S))
reportDuplicate(S, nullptr);
return S;
@@ -222,7 +222,7 @@ Symbol *SymbolTable::addAbsolute(StringR
std::tie(S, WasInserted) = insert(N);
S->IsUsedInRegularObj = true;
if (WasInserted || isa<Undefined>(S) || isa<Lazy>(S))
- replaceBody<DefinedAbsolute>(S, N, VA);
+ replaceSymbol<DefinedAbsolute>(S, N, VA);
else if (!isa<DefinedCOFF>(S))
reportDuplicate(S, nullptr);
return S;
@@ -234,7 +234,7 @@ Symbol *SymbolTable::addSynthetic(String
std::tie(S, WasInserted) = insert(N);
S->IsUsedInRegularObj = true;
if (WasInserted || isa<Undefined>(S) || isa<Lazy>(S))
- replaceBody<DefinedSynthetic>(S, N, C);
+ replaceSymbol<DefinedSynthetic>(S, N, C);
else if (!isa<DefinedCOFF>(S))
reportDuplicate(S, nullptr);
return S;
@@ -252,7 +252,8 @@ Symbol *SymbolTable::addRegular(InputFil
if (SP == SP_CONFLICT) {
reportDuplicate(S, F);
} else if (SP == SP_NEW) {
- replaceBody<DefinedRegular>(S, F, N, IsCOMDAT, /*IsExternal*/ true, Sym, C);
+ replaceSymbol<DefinedRegular>(S, F, N, IsCOMDAT, /*IsExternal*/ true, Sym,
+ C);
} else if (SP == SP_EXISTING && IsCOMDAT && C) {
C->markDiscarded();
// Discard associative chunks that we've parsed so far. No need to recurse
@@ -271,10 +272,10 @@ Symbol *SymbolTable::addCommon(InputFile
if (!isa<BitcodeFile>(F))
S->IsUsedInRegularObj = true;
if (WasInserted || !isa<DefinedCOFF>(S))
- replaceBody<DefinedCommon>(S, F, N, Size, Sym, C);
+ replaceSymbol<DefinedCommon>(S, F, N, Size, Sym, C);
else if (auto *DC = dyn_cast<DefinedCommon>(S))
if (Size > DC->getSize())
- replaceBody<DefinedCommon>(S, F, N, Size, Sym, C);
+ replaceSymbol<DefinedCommon>(S, F, N, Size, Sym, C);
return S;
}
@@ -284,7 +285,7 @@ DefinedImportData *SymbolTable::addImpor
std::tie(S, WasInserted) = insert(N);
S->IsUsedInRegularObj = true;
if (WasInserted || isa<Undefined>(S) || isa<Lazy>(S)) {
- replaceBody<DefinedImportData>(S, N, F);
+ replaceSymbol<DefinedImportData>(S, N, F);
return cast<DefinedImportData>(S);
}
@@ -300,7 +301,7 @@ DefinedImportThunk *SymbolTable::addImpo
std::tie(S, WasInserted) = insert(Name);
S->IsUsedInRegularObj = true;
if (WasInserted || isa<Undefined>(S) || isa<Lazy>(S)) {
- replaceBody<DefinedImportThunk>(S, Name, ID, Machine);
+ replaceSymbol<DefinedImportThunk>(S, Name, ID, Machine);
return cast<DefinedImportThunk>(S);
}
Modified: lld/trunk/COFF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.h?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.h (original)
+++ lld/trunk/COFF/Symbols.h Fri Nov 3 15:48:47 2017
@@ -412,7 +412,7 @@ union SymbolUnion {
};
template <typename T, typename... ArgT>
-void replaceBody(Symbol *S, ArgT &&... Arg) {
+void replaceSymbol(Symbol *S, ArgT &&... Arg) {
static_assert(sizeof(T) <= sizeof(SymbolUnion), "Symbol too small");
static_assert(alignof(T) <= alignof(SymbolUnion),
"SymbolUnion not aligned enough");
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Fri Nov 3 15:48:47 2017
@@ -806,7 +806,7 @@ void Writer::fixSafeSEHSymbols() {
// section relative relocations.
Symbol *T = Symtab->find("___safe_se_handler_table");
Symbol *C = Symtab->find("___safe_se_handler_count");
- replaceBody<DefinedSynthetic>(T, T->getName(), SEHTable);
+ replaceSymbol<DefinedSynthetic>(T, T->getName(), SEHTable);
cast<DefinedAbsolute>(C)->setVA(SEHTable->getSize() / 4);
}
Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Fri Nov 3 15:48:47 2017
@@ -119,8 +119,8 @@ BitcodeCompiler::BitcodeCompiler() : LTO
BitcodeCompiler::~BitcodeCompiler() = default;
static void undefine(Symbol *S) {
- replaceBody<Undefined>(S, nullptr, S->getName(), /*IsLocal=*/false,
- STV_DEFAULT, S->Type);
+ replaceSymbol<Undefined>(S, nullptr, S->getName(), /*IsLocal=*/false,
+ STV_DEFAULT, S->Type);
}
void BitcodeCompiler::add(BitcodeFile &F) {
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Fri Nov 3 15:48:47 2017
@@ -149,8 +149,8 @@ void LinkerScript::addSymbol(SymbolAssig
// write expressions like this: `alignment = 16; . = ALIGN(., alignment)`.
uint64_t SymValue = Value.Sec ? 0 : Value.getValue();
- replaceBody<DefinedRegular>(Sym, nullptr, Cmd->Name, /*IsLocal=*/false,
- Visibility, STT_NOTYPE, SymValue, 0, Sec);
+ replaceSymbol<DefinedRegular>(Sym, nullptr, Cmd->Name, /*IsLocal=*/false,
+ Visibility, STT_NOTYPE, SymValue, 0, Sec);
Cmd->Sym = cast<DefinedRegular>(Sym);
}
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Fri Nov 3 15:48:47 2017
@@ -315,7 +315,7 @@ Symbol *SymbolTable::addUndefined(String
// in the same DSO.
if (WasInserted || (isa<SharedSymbol>(S) && Visibility != STV_DEFAULT)) {
S->Binding = Binding;
- replaceBody<Undefined>(S, File, Name, IsLocal, StOther, Type);
+ replaceSymbol<Undefined>(S, File, Name, IsLocal, StOther, Type);
return S;
}
if (Binding != STB_WEAK) {
@@ -404,7 +404,7 @@ Symbol *SymbolTable::addCommon(StringRef
int Cmp = compareDefined(S, WasInserted, Binding, N);
if (Cmp > 0) {
S->Binding = Binding;
- replaceBody<DefinedCommon>(S, File, N, Size, Alignment, StOther, Type);
+ replaceSymbol<DefinedCommon>(S, File, N, Size, Alignment, StOther, Type);
} else if (Cmp == 0) {
auto *C = dyn_cast<DefinedCommon>(S);
if (!C) {
@@ -419,7 +419,7 @@ Symbol *SymbolTable::addCommon(StringRef
Alignment = C->Alignment = std::max(C->Alignment, Alignment);
if (Size > C->Size)
- replaceBody<DefinedCommon>(S, File, N, Size, Alignment, StOther, Type);
+ replaceSymbol<DefinedCommon>(S, File, N, Size, Alignment, StOther, Type);
}
return S;
}
@@ -480,8 +480,8 @@ Symbol *SymbolTable::addRegular(StringRe
int Cmp = compareDefinedNonCommon(S, WasInserted, Binding, Section == nullptr,
Value, Name);
if (Cmp > 0)
- replaceBody<DefinedRegular>(S, File, Name, /*IsLocal=*/false, StOther, Type,
- Value, Size, Section);
+ replaceSymbol<DefinedRegular>(S, File, Name, /*IsLocal=*/false, StOther,
+ Type, Value, Size, Section);
else if (Cmp == 0)
reportDuplicate<ELFT>(S, dyn_cast_or_null<InputSectionBase>(Section),
Value);
@@ -507,8 +507,8 @@ void SymbolTable::addShared(StringRef Na
// in the same DSO.
if (WasInserted || ((S->isUndefined() || S->isLazy()) &&
S->getVisibility() == STV_DEFAULT)) {
- replaceBody<SharedSymbol>(S, File, Name, Sym.st_other, Sym.getType(),
- Sym.st_value, Sym.st_size, Alignment, Verdef);
+ replaceSymbol<SharedSymbol>(S, File, Name, Sym.st_other, Sym.getType(),
+ Sym.st_value, Sym.st_size, Alignment, Verdef);
if (!S->isWeak())
File->IsUsed = true;
}
@@ -524,8 +524,8 @@ Symbol *SymbolTable::addBitcode(StringRe
int Cmp = compareDefinedNonCommon(S, WasInserted, Binding,
/*IsAbs*/ false, /*Value*/ 0, Name);
if (Cmp > 0)
- replaceBody<DefinedRegular>(S, F, Name, /*IsLocal=*/false, StOther, Type, 0,
- 0, nullptr);
+ replaceSymbol<DefinedRegular>(S, F, Name, /*IsLocal=*/false, StOther, Type,
+ 0, 0, nullptr);
else if (Cmp == 0)
reportDuplicate(S, F);
return S;
@@ -559,7 +559,7 @@ Symbol *SymbolTable::addLazyArchive(Stri
bool WasInserted;
std::tie(S, WasInserted) = insert(Name);
if (WasInserted) {
- replaceBody<LazyArchive>(S, F, Sym, Symbol::UnknownType);
+ replaceSymbol<LazyArchive>(S, F, Sym, Symbol::UnknownType);
return S;
}
if (!S->isUndefined())
@@ -568,7 +568,7 @@ Symbol *SymbolTable::addLazyArchive(Stri
// An undefined weak will not fetch archive members. See comment on Lazy in
// Symbols.h for the details.
if (S->isWeak()) {
- replaceBody<LazyArchive>(S, F, Sym, S->Type);
+ replaceSymbol<LazyArchive>(S, F, Sym, S->Type);
return S;
}
std::pair<MemoryBufferRef, uint64_t> MBInfo = F->getMember(&Sym);
@@ -583,7 +583,7 @@ void SymbolTable::addLazyObject(StringRe
bool WasInserted;
std::tie(S, WasInserted) = insert(Name);
if (WasInserted) {
- replaceBody<LazyObject>(S, &Obj, Name, Symbol::UnknownType);
+ replaceSymbol<LazyObject>(S, &Obj, Name, Symbol::UnknownType);
return;
}
if (!S->isUndefined())
@@ -591,7 +591,7 @@ void SymbolTable::addLazyObject(StringRe
// See comment for addLazyArchive above.
if (S->isWeak())
- replaceBody<LazyObject>(S, &Obj, Name, S->Type);
+ replaceSymbol<LazyObject>(S, &Obj, Name, S->Type);
else if (InputFile *F = Obj.fetch())
addFile<ELFT>(F);
}
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Fri Nov 3 15:48:47 2017
@@ -388,7 +388,7 @@ union SymbolUnion {
void printTraceSymbol(Symbol *Sym);
template <typename T, typename... ArgT>
-void replaceBody(Symbol *S, InputFile *File, ArgT &&... Arg) {
+void replaceSymbol(Symbol *S, InputFile *File, ArgT &&... Arg) {
static_assert(sizeof(T) <= sizeof(SymbolUnion), "SymbolUnion too small");
static_assert(alignof(T) <= alignof(SymbolUnion),
"SymbolUnion not aligned enough");
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=317383&r1=317382&r2=317383&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri Nov 3 15:48:47 2017
@@ -80,9 +80,9 @@ template <class ELFT> void elf::createCo
// Replace all DefinedCommon symbols with DefinedRegular symbols so that we
// don't have to care about DefinedCommon symbols beyond this point.
- replaceBody<DefinedRegular>(S, Sym->getFile(), Sym->getName(),
- static_cast<bool>(Sym->isLocal()), Sym->StOther,
- Sym->Type, 0, Sym->getSize(), Section);
+ replaceSymbol<DefinedRegular>(
+ S, Sym->getFile(), Sym->getName(), static_cast<bool>(Sym->isLocal()),
+ Sym->StOther, Sym->Type, 0, Sym->getSize(), Section);
}
}
More information about the llvm-commits
mailing list