From 7b81f734eec34a475226ad4301ecc5c281a41a3c Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Mon, 18 May 2015 18:43:23 +0000 Subject: [PATCH] MC: clang-format MCContext. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237595 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCContext.h | 43 ++++++++++++++++++------------------------- lib/MC/MCContext.cpp | 17 +++++++++-------- 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h index e2c115b5d19..b62b84a34ce 100644 --- a/include/llvm/MC/MCContext.h +++ b/include/llvm/MC/MCContext.h @@ -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 SymbolTable; + typedef StringMap 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 SectionSymbols; + DenseMap 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, MCSymbol*> LocalSymbols; + DenseMap, MCSymbol *> LocalSymbols; /// Keeps tracks of names that were used both for used declared and /// artificial symbols. - StringMap UsedNames; + StringMap 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 > - SectionStartEndSyms; + MapVector> + 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 MachOUniquingMap; + StringMap MachOUniquingMap; std::map ELFUniquingMap; std::map COFFUniquingMap; StringMap 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 > & + MapVector> & getGenDwarfSectionSyms() { return SectionStartEndSyms; } std::pair >::iterator, + std::pair>::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. diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index b3fadc87926..0d43c262bad 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -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(Section)->setSectionName(CachedName); + const_cast(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& MCDwarfFiles = getMCDwarfFiles(CUID); - if(FileNumber == 0 || FileNumber >= MCDwarfFiles.size()) + const SmallVectorImpl &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 >::iterator - to_erase = sec; + MapVector>::iterator + to_erase = sec; sec = SectionStartEndSyms.erase(to_erase); } } -- 2.11.0