[llvm] r238461 - Remove temporary FileSymbolData. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Thu May 28 12:29:15 PDT 2015
Author: rafael
Date: Thu May 28 14:29:15 2015
New Revision: 238461
URL: http://llvm.org/viewvc/llvm-project?rev=238461&view=rev
Log:
Remove temporary FileSymbolData. NFC.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=238461&r1=238460&r2=238461&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Thu May 28 14:29:15 2015
@@ -112,7 +112,6 @@ class ELFObjectWriter : public MCObjectW
/// @{
StringTableBuilder StrTabBuilder;
- std::vector<uint64_t> FileSymbolData;
std::vector<ELFSymbolData> LocalSymbolData;
std::vector<ELFSymbolData> ExternalSymbolData;
std::vector<ELFSymbolData> UndefinedSymbolData;
@@ -153,7 +152,6 @@ class ELFObjectWriter : public MCObjectW
Renames.clear();
Relocations.clear();
StrTabBuilder.clear();
- FileSymbolData.clear();
LocalSymbolData.clear();
ExternalSymbolData.clear();
UndefinedSymbolData.clear();
@@ -931,14 +929,12 @@ void ELFObjectWriter::computeSymbolTable
SymtabShndxSection->setAlignment(4);
}
- for (const std::string &Name : Asm.getFileNames())
+ ArrayRef<std::string> FileNames = Asm.getFileNames();
+ for (const std::string &Name : FileNames)
StrTabBuilder.add(Name);
StrTabBuilder.finalize(StringTableBuilder::ELF);
- for (const std::string &Name : Asm.getFileNames())
- FileSymbolData.push_back(StrTabBuilder.getOffset(Name));
-
// Symbols are required to be in lexicographic order.
array_pod_sort(LocalSymbolData.begin(), LocalSymbolData.end());
array_pod_sort(ExternalSymbolData.begin(), ExternalSymbolData.end());
@@ -946,7 +942,7 @@ void ELFObjectWriter::computeSymbolTable
// Set the symbol indices. Local symbols must come before all other
// symbols with non-local bindings.
- unsigned Index = FileSymbolData.size() + 1;
+ unsigned Index = FileNames.size() + 1;
for (ELFSymbolData &MSD : LocalSymbolData) {
MSD.StringIndex = MCELF::GetType(MSD.Symbol->getData()) == ELF::STT_SECTION
@@ -963,13 +959,13 @@ void ELFObjectWriter::computeSymbolTable
MSD.Symbol->setIndex(Index++);
}
- for (unsigned i = 0, e = FileSymbolData.size(); i != e; ++i) {
- Writer.writeSymbol(FileSymbolData[i], ELF::STT_FILE | ELF::STB_LOCAL, 0, 0,
- ELF::STV_DEFAULT, ELF::SHN_ABS, true);
- }
+ for (const std::string &Name : FileNames)
+ Writer.writeSymbol(StrTabBuilder.getOffset(Name),
+ ELF::STT_FILE | ELF::STB_LOCAL, 0, 0, ELF::STV_DEFAULT,
+ ELF::SHN_ABS, true);
// Write the symbol table entries.
- LastLocalSymbolIndex = FileSymbolData.size() + LocalSymbolData.size() + 1;
+ LastLocalSymbolIndex = FileNames.size() + LocalSymbolData.size() + 1;
for (unsigned i = 0, e = LocalSymbolData.size(); i != e; ++i) {
ELFSymbolData &MSD = LocalSymbolData[i];
More information about the llvm-commits
mailing list