[llvm] r237595 - MC: clang-format MCContext. NFC.

Jim Grosbach grosbach at apple.com
Mon May 18 11:43:24 PDT 2015


Author: grosbach
Date: Mon May 18 13:43:23 2015
New Revision: 237595

URL: http://llvm.org/viewvc/llvm-project?rev=237595&view=rev
Log:
MC: clang-format MCContext. NFC.

Modified:
    llvm/trunk/include/llvm/MC/MCContext.h
    llvm/trunk/lib/MC/MCContext.cpp

Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=237595&r1=237594&r2=237595&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Mon May 18 13:43:23 2015
@@ -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.

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=237595&r1=237594&r2=237595&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Mon May 18 13:43:23 2015
@@ -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 M
       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(StringR
 /// 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(MC
       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);
     }
   }





More information about the llvm-commits mailing list