[lld] r368651 - [ELF] Rename odd variable names "New" after r365730. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 23:19:39 PDT 2019
Author: maskray
Date: Mon Aug 12 23:19:39 2019
New Revision: 368651
URL: http://llvm.org/viewvc/llvm-project?rev=368651&view=rev
Log:
[ELF] Rename odd variable names "New" after r365730. NFC
New -> newSym or newFlags
Reviewed By: atanasyan
Differential Revision: https://reviews.llvm.org/D66127
Modified:
lld/trunk/ELF/Arch/MipsArchTree.cpp
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/Arch/MipsArchTree.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/MipsArchTree.cpp?rev=368651&r1=368650&r2=368651&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/MipsArchTree.cpp (original)
+++ lld/trunk/ELF/Arch/MipsArchTree.cpp Mon Aug 12 23:19:39 2019
@@ -166,17 +166,17 @@ static ArchTreeEdge archTree[] = {
{EF_MIPS_ARCH_2, EF_MIPS_ARCH_1},
};
-static bool isArchMatched(uint32_t New, uint32_t res) {
- if (New == res)
+static bool isArchMatched(uint32_t newFlags, uint32_t res) {
+ if (newFlags == res)
return true;
- if (New == EF_MIPS_ARCH_32 && isArchMatched(EF_MIPS_ARCH_64, res))
+ if (newFlags == EF_MIPS_ARCH_32 && isArchMatched(EF_MIPS_ARCH_64, res))
return true;
- if (New == EF_MIPS_ARCH_32R2 && isArchMatched(EF_MIPS_ARCH_64R2, res))
+ if (newFlags == EF_MIPS_ARCH_32R2 && isArchMatched(EF_MIPS_ARCH_64R2, res))
return true;
for (const auto &edge : archTree) {
if (res == edge.child) {
res = edge.parent;
- if (res == New)
+ if (res == newFlags)
return true;
}
}
@@ -278,18 +278,18 @@ static uint32_t getArchFlags(ArrayRef<Fi
uint32_t ret = files[0].flags & (EF_MIPS_ARCH | EF_MIPS_MACH);
for (const FileFlags &f : files.slice(1)) {
- uint32_t New = f.flags & (EF_MIPS_ARCH | EF_MIPS_MACH);
+ uint32_t newFlags = f.flags & (EF_MIPS_ARCH | EF_MIPS_MACH);
// Check ISA compatibility.
- if (isArchMatched(New, ret))
+ if (isArchMatched(newFlags, ret))
continue;
- if (!isArchMatched(ret, New)) {
+ if (!isArchMatched(ret, newFlags)) {
error("incompatible target ISA:\n>>> " + toString(files[0].file) + ": " +
getFullArchName(ret) + "\n>>> " + toString(f.file) + ": " +
- getFullArchName(New));
+ getFullArchName(newFlags));
return 0;
}
- ret = New;
+ ret = newFlags;
}
return ret;
}
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=368651&r1=368650&r2=368651&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Mon Aug 12 23:19:39 2019
@@ -1475,10 +1475,10 @@ static Symbol *createBitcodeSymbol(const
int c = objSym.getComdatIndex();
if (objSym.isUndefined() || (c != -1 && !keptComdats[c])) {
- Undefined New(&f, name, binding, visibility, type);
+ Undefined newSym(&f, name, binding, visibility, type);
if (canOmitFromDynSym)
- New.exportDynamic = false;
- return symtab->addSymbol(New);
+ newSym.exportDynamic = false;
+ return symtab->addSymbol(newSym);
}
if (objSym.isCommon())
@@ -1486,10 +1486,10 @@ static Symbol *createBitcodeSymbol(const
CommonSymbol{&f, name, binding, visibility, STT_OBJECT,
objSym.getCommonAlignment(), objSym.getCommonSize()});
- Defined New(&f, name, binding, visibility, type, 0, 0, nullptr);
+ Defined newSym(&f, name, binding, visibility, type, 0, 0, nullptr);
if (canOmitFromDynSym)
- New.exportDynamic = false;
- return symtab->addSymbol(New);
+ newSym.exportDynamic = false;
+ return symtab->addSymbol(newSym);
}
template <class ELFT> void BitcodeFile::parse() {
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=368651&r1=368650&r2=368651&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Aug 12 23:19:39 2019
@@ -181,12 +181,12 @@ void LinkerScript::addSymbol(SymbolAssig
// write expressions like this: `alignment = 16; . = ALIGN(., alignment)`.
uint64_t symValue = value.sec ? 0 : value.getValue();
- Defined New(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, symValue,
- 0, sec);
+ Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE,
+ symValue, 0, sec);
Symbol *sym = symtab->insert(cmd->name);
- sym->mergeProperties(New);
- sym->replace(New);
+ sym->mergeProperties(newSym);
+ sym->replace(newSym);
cmd->sym = cast<Defined>(sym);
}
@@ -197,13 +197,13 @@ static void declareSymbol(SymbolAssignme
return;
uint8_t visibility = cmd->hidden ? STV_HIDDEN : STV_DEFAULT;
- Defined New(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, 0, 0,
- nullptr);
+ Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, 0, 0,
+ nullptr);
// We can't calculate final value right now.
Symbol *sym = symtab->insert(cmd->name);
- sym->mergeProperties(New);
- sym->replace(New);
+ sym->mergeProperties(newSym);
+ sym->replace(newSym);
cmd->sym = cast<Defined>(sym);
cmd->provide = false;
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=368651&r1=368650&r2=368651&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Mon Aug 12 23:19:39 2019
@@ -83,9 +83,9 @@ Symbol *SymbolTable::insert(StringRef na
return sym;
}
-Symbol *SymbolTable::addSymbol(const Symbol &New) {
- Symbol *sym = symtab->insert(New.getName());
- sym->resolve(New);
+Symbol *SymbolTable::addSymbol(const Symbol &newSym) {
+ Symbol *sym = symtab->insert(newSym.getName());
+ sym->resolve(newSym);
return sym;
}
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=368651&r1=368650&r2=368651&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Mon Aug 12 23:19:39 2019
@@ -43,7 +43,7 @@ public:
Symbol *insert(StringRef name);
- Symbol *addSymbol(const Symbol &New);
+ Symbol *addSymbol(const Symbol &newSym);
void scanVersionScript();
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=368651&r1=368650&r2=368651&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Mon Aug 12 23:19:39 2019
@@ -135,7 +135,7 @@ public:
// True if this symbol is specified by --trace-symbol option.
unsigned traced : 1;
- inline void replace(const Symbol &New);
+ inline void replace(const Symbol &newSym);
bool includeInDynsym() const;
uint8_t computeBinding() const;
@@ -511,7 +511,7 @@ size_t Symbol::getSymbolSize() const {
// replace() replaces "this" object with a given symbol by memcpy'ing
// it over to "this". This function is called as a result of name
// resolution, e.g. to replace an undefind symbol with a defined symbol.
-void Symbol::replace(const Symbol &New) {
+void Symbol::replace(const Symbol &newSym) {
using llvm::ELF::STT_TLS;
// Symbols representing thread-local variables must be referenced by
@@ -519,16 +519,13 @@ void Symbol::replace(const Symbol &New)
// non-TLS relocations, so there's a clear distinction between TLS
// and non-TLS symbols. It is an error if the same symbol is defined
// as a TLS symbol in one file and as a non-TLS symbol in other file.
- if (symbolKind != PlaceholderKind && !isLazy() && !New.isLazy()) {
- bool tlsMismatch = (type == STT_TLS && New.type != STT_TLS) ||
- (type != STT_TLS && New.type == STT_TLS);
- if (tlsMismatch)
- error("TLS attribute mismatch: " + toString(*this) + "\n>>> defined in " +
- toString(New.file) + "\n>>> defined in " + toString(file));
- }
+ if (symbolKind != PlaceholderKind && !isLazy() && !newSym.isLazy() &&
+ (type == STT_TLS) != (newSym.type == STT_TLS))
+ error("TLS attribute mismatch: " + toString(*this) + "\n>>> defined in " +
+ toString(newSym.file) + "\n>>> defined in " + toString(file));
Symbol old = *this;
- memcpy(this, &New, New.getSymbolSize());
+ memcpy(this, &newSym, newSym.getSymbolSize());
versionId = old.versionId;
visibility = old.visibility;
More information about the llvm-commits
mailing list