[llvm] r238156 - Make a few MCSectionELF& variables const. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Mon May 25 14:56:56 PDT 2015
Author: rafael
Date: Mon May 25 16:56:55 2015
New Revision: 238156
URL: http://llvm.org/viewvc/llvm-project?rev=238156&view=rev
Log:
Make a few MCSectionELF& variables const. NFC.
This just reduces the noise from another patch.
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=238156&r1=238155&r2=238156&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon May 25 16:56:55 2015
@@ -132,8 +132,8 @@ class ELFObjectWriter : public MCObjectW
unsigned SymtabShndxSectionIndex = 0;
// Sections in the order they are to be output in the section table.
- std::vector<MCSectionELF *> SectionTable;
- unsigned addToSectionTable(MCSectionELF *Sec);
+ std::vector<const MCSectionELF *> SectionTable;
+ unsigned addToSectionTable(const MCSectionELF *Sec);
// TargetObjectWriter wrappers.
bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
@@ -256,7 +256,7 @@ class ELFObjectWriter : public MCObjectW
};
}
-unsigned ELFObjectWriter::addToSectionTable(MCSectionELF *Sec) {
+unsigned ELFObjectWriter::addToSectionTable(const MCSectionELF *Sec) {
SectionTable.push_back(Sec);
StrTabBuilder.add(Sec->getSectionName());
return SectionTable.size();
@@ -538,7 +538,7 @@ void ELFObjectWriter::WriteSymbol(Symbol
void ELFObjectWriter::writeSymbolTable(MCContext &Ctx,
const MCAsmLayout &Layout,
SectionOffsetsTy &SectionOffsets) {
- MCSectionELF *SymtabSection = SectionTable[SymbolTableIndex - 1];
+ const MCSectionELF *SymtabSection = SectionTable[SymbolTableIndex - 1];
// The string table must be emitted first because we need the index
// into the string table for all the symbol names.
@@ -597,7 +597,8 @@ void ELFObjectWriter::writeSymbolTable(M
assert(SymtabShndxSectionIndex != 0);
SecStart = OS.tell();
- MCSectionELF *SymtabShndxSection = SectionTable[SymtabShndxSectionIndex - 1];
+ const MCSectionELF *SymtabShndxSection =
+ SectionTable[SymtabShndxSectionIndex - 1];
for (uint32_t Index : ShndxIndexes)
write(Index);
SecEnd = OS.tell();
@@ -1240,7 +1241,7 @@ void ELFObjectWriter::writeRelocations(c
}
const MCSectionELF *ELFObjectWriter::createStringTable(MCContext &Ctx) {
- MCSectionELF *StrtabSection = SectionTable[StringTableIndex - 1];
+ const MCSectionELF *StrtabSection = SectionTable[StringTableIndex - 1];
OS << StrTabBuilder.data();
return StrtabSection;
}
@@ -1305,7 +1306,7 @@ void ELFObjectWriter::writeSectionHeader
(NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
- for (MCSectionELF *Section : SectionTable) {
+ for (const MCSectionELF *Section : SectionTable) {
uint32_t GroupSymbolIndex;
unsigned Type = Section->getType();
if (Type != ELF::SHT_GROUP)
@@ -1348,7 +1349,7 @@ void ELFObjectWriter::WriteObject(MCAsse
std::vector<MCSectionELF *> Groups;
std::vector<MCSectionELF *> Relocations;
for (const MCSectionData &SD : Asm) {
- MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
+ const MCSectionELF &Section = static_cast<MCSectionELF &>(SD.getSection());
uint64_t Padding = OffsetToAlignment(OS.tell(), Section.getAlignment());
WriteZeros(Padding);
More information about the llvm-commits
mailing list