MC: clang-format MCContext. NFC.

llvm-svn: 237595
This commit is contained in:
Jim Grosbach 2015-05-18 18:43:23 +00:00
parent 95c79d189f
commit 90e903fa61
2 changed files with 27 additions and 33 deletions

View File

@ -45,10 +45,12 @@ namespace llvm {
/// sections that it creates.
///
class MCContext {
MCContext(const MCContext&) = delete;
MCContext &operator=(const MCContext&) = delete;
MCContext(const MCContext &) = delete;
MCContext &operator=(const MCContext &) = delete;
public:
typedef StringMap<MCSymbol*, BumpPtrAllocator&> SymbolTable;
typedef StringMap<MCSymbol *, BumpPtrAllocator &> SymbolTable;
private:
/// The SourceMgr for this object, if any.
const SourceMgr *SrcMgr;
@ -73,7 +75,7 @@ namespace llvm {
/// ELF sections can have a corresponding symbol. This maps one to the
/// other.
DenseMap<const MCSectionELF*, MCSymbol*> SectionSymbols;
DenseMap<const MCSectionELF *, MCSymbol *> SectionSymbols;
/// A mapping from a local label number and an instance count to a symbol.
/// For example, in the assembly
@ -81,11 +83,11 @@ namespace llvm {
/// 2:
/// 1:
/// We have three labels represented by the pairs (1, 0), (2, 0) and (1, 1)
DenseMap<std::pair<unsigned, unsigned>, MCSymbol*> LocalSymbols;
DenseMap<std::pair<unsigned, unsigned>, MCSymbol *> LocalSymbols;
/// Keeps tracks of names that were used both for used declared and
/// artificial symbols.
StringMap<bool, BumpPtrAllocator&> UsedNames;
StringMap<bool, BumpPtrAllocator &> UsedNames;
/// The next ID to dole out to an unnamed assembler temporary symbol with
/// a given prefix.
@ -136,8 +138,8 @@ namespace llvm {
/// Symbols created for the start and end of each section, used for
/// generating the .debug_ranges and .debug_aranges sections.
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> >
SectionStartEndSyms;
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *>>
SectionStartEndSyms;
/// The information gathered from labels that will have dwarf label
/// entries when generating dwarf assembly source files.
@ -197,7 +199,7 @@ namespace llvm {
}
};
StringMap<const MCSectionMachO*> MachOUniquingMap;
StringMap<const MCSectionMachO *> MachOUniquingMap;
std::map<ELFSectionKey, const MCSectionELF *> ELFUniquingMap;
std::map<COFFSectionKey, const MCSectionCOFF *> COFFUniquingMap;
StringMap<bool> ELFRelSecNames;
@ -280,9 +282,7 @@ namespace llvm {
/// want to, for example, iterate over all symbols. 'const' because we
/// still want any modifications to the table itself to use the MCContext
/// APIs.
const SymbolTable &getSymbols() const {
return Symbols;
}
const SymbolTable &getSymbols() const { return Symbols; }
/// @}
@ -433,9 +433,7 @@ namespace llvm {
return true;
return false;
}
unsigned getDwarfCompileUnitID() {
return DwarfCompileUnitID;
}
unsigned getDwarfCompileUnitID() { return DwarfCompileUnitID; }
void setDwarfCompileUnitID(unsigned CUIndex) {
DwarfCompileUnitID = CUIndex;
}
@ -469,12 +467,12 @@ namespace llvm {
void setGenDwarfFileNumber(unsigned FileNumber) {
GenDwarfFileNumber = FileNumber;
}
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> > &
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *>> &
getGenDwarfSectionSyms() {
return SectionStartEndSyms;
}
std::pair<MapVector<const MCSection *,
std::pair<MCSymbol *, MCSymbol *> >::iterator,
std::pair<MCSymbol *, MCSymbol *>>::iterator,
bool>
addGenDwarfSection(const MCSection *Sec) {
return SectionStartEndSyms.insert(
@ -502,18 +500,13 @@ namespace llvm {
char *getSecureLogFile() { return SecureLogFile; }
raw_ostream *getSecureLog() { return SecureLog; }
bool getSecureLogUsed() { return SecureLogUsed; }
void setSecureLog(raw_ostream *Value) {
SecureLog = Value;
}
void setSecureLogUsed(bool Value) {
SecureLogUsed = Value;
}
void setSecureLog(raw_ostream *Value) { SecureLog = Value; }
void setSecureLogUsed(bool Value) { SecureLogUsed = Value; }
void *allocate(unsigned Size, unsigned Align = 8) {
return Allocator.Allocate(Size, Align);
}
void deallocate(void *Ptr) {
}
void deallocate(void *Ptr) {}
// Unrecoverable error has occurred. Display the best diagnostic we can
// and bail via exit(1). For now, most MC backend errors are unrecoverable.

View File

@ -62,7 +62,7 @@ MCContext::~MCContext() {
// we don't need to free them here.
// If the stream for the .secure_log_unique directive was created free it.
delete (raw_ostream*)SecureLog;
delete (raw_ostream *)SecureLog;
}
//===----------------------------------------------------------------------===//
@ -81,7 +81,7 @@ void MCContext::reset() {
MCGenDwarfLabelEntries.clear();
DwarfDebugFlags = StringRef();
DwarfCompileUnitID = 0;
CurrentDwarfLoc = MCDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0);
CurrentDwarfLoc = MCDwarfLoc(0, 0, 0, DWARF2_FLAG_IS_STMT, 0, 0);
MachOUniquingMap.clear();
ELFUniquingMap.clear();
@ -275,9 +275,10 @@ void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
ELFSectionKey{Section->getSectionName(), GroupName, UniqueID});
auto I = ELFUniquingMap.insert(std::make_pair(
ELFSectionKey{Name, GroupName, UniqueID},
Section)).first;
Section))
.first;
StringRef CachedName = I->first.SectionName;
const_cast<MCSectionELF*>(Section)->setSectionName(CachedName);
const_cast<MCSectionELF *>(Section)->setSectionName(CachedName);
}
const MCSectionELF *
@ -424,8 +425,8 @@ unsigned MCContext::getDwarfFile(StringRef Directory, StringRef FileName,
/// isValidDwarfFileNumber - takes a dwarf file number and returns true if it
/// currently is assigned and false otherwise.
bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
const SmallVectorImpl<MCDwarfFile>& MCDwarfFiles = getMCDwarfFiles(CUID);
if(FileNumber == 0 || FileNumber >= MCDwarfFiles.size())
const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles = getMCDwarfFiles(CUID);
if (FileNumber == 0 || FileNumber >= MCDwarfFiles.size())
return false;
return !MCDwarfFiles[FileNumber].Name.empty();
@ -447,8 +448,8 @@ void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
sec->second.second = SectionEndSym;
++sec;
} else {
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *> >::iterator
to_erase = sec;
MapVector<const MCSection *, std::pair<MCSymbol *, MCSymbol *>>::iterator
to_erase = sec;
sec = SectionStartEndSyms.erase(to_erase);
}
}