[ELF] - Apply clang-format. NFC.

llvm-svn: 308297
diff --git a/lld/ELF/Arch/MipsArchTree.cpp b/lld/ELF/Arch/MipsArchTree.cpp
index ed183e9..3d1dc1d 100644
--- a/lld/ELF/Arch/MipsArchTree.cpp
+++ b/lld/ELF/Arch/MipsArchTree.cpp
@@ -37,7 +37,7 @@
   StringRef Filename;
   uint32_t Flags;
 };
-}
+} // namespace
 
 static StringRef getAbiName(uint32_t Flags) {
   switch (Flags) {
@@ -337,8 +337,8 @@
     return NewFlag;
   if (compareMipsFpAbi(OldFlag, NewFlag) < 0)
     error("target floating point ABI '" + getMipsFpAbiName(OldFlag) +
-          "' is incompatible with '" + getMipsFpAbiName(NewFlag) + "': " +
-          FileName);
+          "' is incompatible with '" + getMipsFpAbiName(NewFlag) +
+          "': " + FileName);
   return OldFlag;
 }
 
diff --git a/lld/ELF/EhFrame.h b/lld/ELF/EhFrame.h
index 4e2b6f8..07d1aaa 100644
--- a/lld/ELF/EhFrame.h
+++ b/lld/ELF/EhFrame.h
@@ -19,7 +19,7 @@
 
 template <class ELFT> size_t readEhRecordSize(InputSectionBase *S, size_t Off);
 template <class ELFT> uint8_t getFdeEncoding(EhSectionPiece *P);
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/Filesystem.h b/lld/ELF/Filesystem.h
index d56d067..dbeadac 100644
--- a/lld/ELF/Filesystem.h
+++ b/lld/ELF/Filesystem.h
@@ -16,7 +16,7 @@
 namespace elf {
 void unlinkAsync(StringRef Path);
 std::error_code tryCreateFile(StringRef Path);
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/GdbIndex.h b/lld/ELF/GdbIndex.h
index c49f894..bc024e6 100644
--- a/lld/ELF/GdbIndex.h
+++ b/lld/ELF/GdbIndex.h
@@ -11,8 +11,8 @@
 #define LLD_ELF_GDB_INDEX_H
 
 #include "InputFiles.h"
-#include "llvm/Object/ELF.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
+#include "llvm/Object/ELF.h"
 
 namespace lld {
 namespace elf {
diff --git a/lld/ELF/ICF.h b/lld/ELF/ICF.h
index 502e128c..2421985 100644
--- a/lld/ELF/ICF.h
+++ b/lld/ELF/ICF.h
@@ -14,6 +14,6 @@
 namespace elf {
 template <class ELFT> void doIcf();
 }
-}
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index 544a0b0..f6d3f90 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -11,8 +11,8 @@
 #define LLD_ELF_INPUT_FILES_H
 
 #include "Config.h"
-#include "InputSection.h"
 #include "Error.h"
+#include "InputSection.h"
 #include "Symbols.h"
 
 #include "lld/Core/LLVM.h"
@@ -34,7 +34,7 @@
 namespace lto {
 class InputFile;
 }
-}
+} // namespace llvm
 
 namespace lld {
 namespace elf {
diff --git a/lld/ELF/LTO.h b/lld/ELF/LTO.h
index 28afa0e..d19923c 100644
--- a/lld/ELF/LTO.h
+++ b/lld/ELF/LTO.h
@@ -30,7 +30,7 @@
 namespace lto {
 class LTO;
 }
-}
+} // namespace llvm
 
 namespace lld {
 namespace elf {
@@ -51,7 +51,7 @@
   std::vector<SmallString<0>> Buff;
   std::vector<std::unique_ptr<MemoryBuffer>> Files;
 };
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 8bab0f9..8bdbd8d 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -462,7 +462,7 @@
   // The Sections with -T<section> have been sorted in order of ascending
   // address. We must lower StartAddr if the lowest -T<section address> as
   // calls to setDot() must be monotonically increasing.
-  for (auto& KV : Config->SectionStartMap)
+  for (auto &KV : Config->SectionStartMap)
     StartAddr = std::min(StartAddr, KV.second);
 
   Commands.push_back(make<SymbolAssignment>(
@@ -752,7 +752,7 @@
       Cmd->MemRegion = findMemoryRegion(Cmd);
       // Handle align (e.g. ".foo : ALIGN(16) { ... }").
       if (Cmd->AlignExpr)
-	Cmd->Sec->updateAlignment(Cmd->AlignExpr().getValue());
+        Cmd->Sec->updateAlignment(Cmd->AlignExpr().getValue());
     }
   }
 
diff --git a/lld/ELF/MapFile.h b/lld/ELF/MapFile.h
index 68d8ba8..460848f 100644
--- a/lld/ELF/MapFile.h
+++ b/lld/ELF/MapFile.h
@@ -17,7 +17,7 @@
 struct OutputSectionCommand;
 template <class ELFT>
 void writeMapFile(llvm::ArrayRef<OutputSectionCommand *> Script);
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/Memory.h b/lld/ELF/Memory.h
index e5a04ed..4000f2f 100644
--- a/lld/ELF/Memory.h
+++ b/lld/ELF/Memory.h
@@ -61,7 +61,7 @@
     Alloc->reset();
   BAlloc.Reset();
 }
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index d6ae5dc..abe5481 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -222,16 +222,16 @@
 
   if (Sec) {
     if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(IS->Flags))
-      error("incompatible section flags for " + Sec->Name +
-            "\n>>> " + toString(IS) + ": 0x" + utohexstr(IS->Flags) +
+      error("incompatible section flags for " + Sec->Name + "\n>>> " +
+            toString(IS) + ": 0x" + utohexstr(IS->Flags) +
             "\n>>> output section " + Sec->Name + ": 0x" +
             utohexstr(Sec->Flags));
     if (Sec->Type != IS->Type) {
       if (canMergeToProgbits(Sec->Type) && canMergeToProgbits(IS->Type))
         Sec->Type = SHT_PROGBITS;
       else
-        error("section type mismatch for " + IS->Name +
-              "\n>>> " + toString(IS) + ": " +
+        error("section type mismatch for " + IS->Name + "\n>>> " +
+              toString(IS) + ": " +
               getELFSectionTypeName(Config->EMachine, IS->Type) +
               "\n>>> output section " + Sec->Name + ": " +
               getELFSectionTypeName(Config->EMachine, Sec->Type));
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index 68ee066..68b46eb 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -111,8 +111,8 @@
   uint64_t Flags;
   uint32_t Alignment;
 };
-}
-}
+} // namespace elf
+} // namespace lld
 namespace llvm {
 template <> struct DenseMapInfo<lld::elf::SectionKey> {
   static lld::elf::SectionKey getEmptyKey();
@@ -121,7 +121,7 @@
   static bool isEqual(const lld::elf::SectionKey &LHS,
                       const lld::elf::SectionKey &RHS);
 };
-}
+} // namespace llvm
 namespace lld {
 namespace elf {
 
@@ -150,5 +150,4 @@
 } // namespace elf
 } // namespace lld
 
-
 #endif
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 59a6a24..e5fcb2d 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -276,7 +276,7 @@
     } else {
       C.Relocations.push_back(
           {Target->adjustRelaxExpr(Type, nullptr, R_RELAX_TLS_GD_TO_LE), Type,
-                Offset, Addend, &Body});
+           Offset, Addend, &Body});
     }
     return Target->TlsGdRelaxSkip;
   }
@@ -1028,7 +1028,7 @@
   OutputSectionCommand *C = Script->getCmd(TOS);
   std::vector<InputSection *> *Range = nullptr;
   for (BaseCommand *BC : C->Commands)
-    if (auto *ISD = dyn_cast<InputSectionDescription> (BC)) {
+    if (auto *ISD = dyn_cast<InputSectionDescription>(BC)) {
       InputSection *first = ISD->Sections.front();
       InputSection *last = ISD->Sections.back();
       if (IS->OutSecOff >= first->OutSecOff &&
@@ -1050,7 +1050,6 @@
   return TS;
 }
 
-
 std::pair<Thunk *, bool> ThunkCreator::getThunk(SymbolBody &Body,
                                                 uint32_t Type) {
   auto Res = ThunkedSymbols.insert({&Body, std::vector<Thunk *>()});
@@ -1107,32 +1106,32 @@
   // We separate the creation of ThunkSections from the insertion of the
   // ThunkSections back into the OutputSection as ThunkSections are not always
   // inserted into the same OutputSection as the caller.
-  forEachExecInputSection(
-      OutputSections, [&](OutputSectionCommand *Cmd,
-                          std::vector<InputSection *> *ISR, InputSection *IS) {
-        for (Relocation &Rel : IS->Relocations) {
-          SymbolBody &Body = *Rel.Sym;
-          if (Thunks.find(&Body) != Thunks.end() ||
-              !Target->needsThunk(Rel.Expr, Rel.Type, IS->File, Body))
-            continue;
-          Thunk *T;
-          bool IsNew;
-          std::tie(T, IsNew) = getThunk(Body, Rel.Type);
-          if (IsNew) {
-            // Find or create a ThunkSection for the new Thunk
-            ThunkSection *TS;
-            if (auto *TIS = T->getTargetInputSection())
-              TS = getISThunkSec(TIS, Cmd->Sec);
-            else
-              TS = getOSThunkSec(Cmd, ISR);
-            TS->addThunk(T);
-            Thunks[T->ThunkSym] = T;
-          }
-          // Redirect relocation to Thunk, we never go via the PLT to a Thunk
-          Rel.Sym = T->ThunkSym;
-          Rel.Expr = fromPlt(Rel.Expr);
-        }
-      });
+  forEachExecInputSection(OutputSections, [&](OutputSectionCommand *Cmd,
+                                              std::vector<InputSection *> *ISR,
+                                              InputSection *IS) {
+    for (Relocation &Rel : IS->Relocations) {
+      SymbolBody &Body = *Rel.Sym;
+      if (Thunks.find(&Body) != Thunks.end() ||
+          !Target->needsThunk(Rel.Expr, Rel.Type, IS->File, Body))
+        continue;
+      Thunk *T;
+      bool IsNew;
+      std::tie(T, IsNew) = getThunk(Body, Rel.Type);
+      if (IsNew) {
+        // Find or create a ThunkSection for the new Thunk
+        ThunkSection *TS;
+        if (auto *TIS = T->getTargetInputSection())
+          TS = getISThunkSec(TIS, Cmd->Sec);
+        else
+          TS = getOSThunkSec(Cmd, ISR);
+        TS->addThunk(T);
+        Thunks[T->ThunkSym] = T;
+      }
+      // Redirect relocation to Thunk, we never go via the PLT to a Thunk
+      Rel.Sym = T->ThunkSym;
+      Rel.Expr = fromPlt(Rel.Expr);
+    }
+  });
   // Merge all created synthetic ThunkSections back into OutputSection
   mergeThunks();
   ++Pass;
diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h
index 3222f31..ea046d2 100644
--- a/lld/ELF/Relocations.h
+++ b/lld/ELF/Relocations.h
@@ -103,7 +103,8 @@
 // RelExpr's as a constant bit mask and test for membership with a
 // couple cheap bitwise operations.
 template <RelExpr... Exprs> bool isRelExprOneOf(RelExpr Expr) {
-  assert(0 <= Expr && (int)Expr < 64 && "RelExpr is too large for 64-bit mask!");
+  assert(0 <= Expr && (int)Expr < 64 &&
+         "RelExpr is too large for 64-bit mask!");
   return (uint64_t(1) << Expr) & RelExprMaskBuilder<Exprs...>::build();
 }
 
@@ -178,7 +179,7 @@
 static inline int64_t getAddend(const typename ELFT::Rela &Rel) {
   return Rel.r_addend;
 }
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/Strings.h b/lld/ELF/Strings.h
index 6f5b3a2..68ccafa 100644
--- a/lld/ELF/Strings.h
+++ b/lld/ELF/Strings.h
@@ -73,7 +73,7 @@
 inline ArrayRef<uint8_t> toArrayRef(StringRef S) {
   return {(const uint8_t *)S.data(), S.size()};
 }
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index bf5498c..8309105 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -172,8 +172,8 @@
 }
 
 // Creates alias for symbol. Used to implement --defsym=ALIAS=SYM.
-template <class ELFT> void SymbolTable<ELFT>::addSymbolAlias(StringRef Alias,
-                                                             StringRef Name) {
+template <class ELFT>
+void SymbolTable<ELFT>::addSymbolAlias(StringRef Alias, StringRef Name) {
   SymbolBody *B = find(Name);
   if (!B) {
     error("-defsym: undefined symbol: " + Name);
@@ -393,9 +393,8 @@
 }
 
 static void reportDuplicate(SymbolBody *Sym, InputFile *NewFile) {
-  warnOrError("duplicate symbol: " + toString(*Sym) +
-              "\n>>> defined in " + toString(Sym->File) +
-              "\n>>> defined in " + toString(NewFile));
+  warnOrError("duplicate symbol: " + toString(*Sym) + "\n>>> defined in " +
+              toString(Sym->File) + "\n>>> defined in " + toString(NewFile));
 }
 
 template <class ELFT>
@@ -673,7 +672,8 @@
 // Set symbol versions to symbols. This function handles patterns
 // containing no wildcard characters.
 template <class ELFT>
-void SymbolTable<ELFT>::assignExactVersion(SymbolVersion Ver, uint16_t VersionId,
+void SymbolTable<ELFT>::assignExactVersion(SymbolVersion Ver,
+                                           uint16_t VersionId,
                                            StringRef VersionName) {
   if (Ver.HasWildcard)
     return;
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 8244606..1cf4866 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -817,9 +817,7 @@
          LocalEntries32.size();
 }
 
-void MipsGotSection::finalizeContents() {
-  updateAllocSize();
-}
+void MipsGotSection::finalizeContents() { updateAllocSize(); }
 
 void MipsGotSection::updateAllocSize() {
   PageEntriesNum = 0;
@@ -843,9 +841,7 @@
   return Config->Relocatable;
 }
 
-uint64_t MipsGotSection::getGp() const {
-  return ElfSym::MipsGp->getVA(0);
-}
+uint64_t MipsGotSection::getGp() const { return ElfSym::MipsGp->getVA(0); }
 
 static uint64_t readUint(uint8_t *Buf) {
   if (Config->Is64)
@@ -1614,7 +1610,7 @@
 template <class ELFT> void HashTableSection<ELFT>::finalizeContents() {
   getParent()->Link = InX::DynSymTab->getParent()->SectionIndex;
 
-  unsigned NumEntries = 2;                            // nbucket and nchain.
+  unsigned NumEntries = 2;                       // nbucket and nchain.
   NumEntries += InX::DynSymTab->getNumSymbols(); // The chain entries.
 
   // Create as many buckets as there are symbols.
@@ -1933,9 +1929,7 @@
   StringPool.write(Buf);
 }
 
-bool GdbIndexSection::empty() const {
-  return !Out::DebugInfo;
-}
+bool GdbIndexSection::empty() const { return !Out::DebugInfo; }
 
 template <class ELFT>
 EhFrameHeader<ELFT>::EhFrameHeader()
@@ -2218,9 +2212,7 @@
     finalizeNoTailMerge();
 }
 
-size_t MergeSyntheticSection::getSize() const {
-  return Builder.getSize();
-}
+size_t MergeSyntheticSection::getSize() const { return Builder.getSize(); }
 
 // This function decompresses compressed sections and scans over the input
 // sections to create mergeable synthetic sections. It removes
diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h
index f918f13..1658a81 100644
--- a/lld/ELF/Target.h
+++ b/lld/ELF/Target.h
@@ -157,6 +157,6 @@
           lld::toString(Type));
 }
 } // namespace elf
-}
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/Threads.h b/lld/ELF/Threads.h
index e01afd4..9feb868 100644
--- a/lld/ELF/Threads.h
+++ b/lld/ELF/Threads.h
@@ -82,7 +82,7 @@
   else
     for_each_n(llvm::parallel::seq, Begin, End, Fn);
 }
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif
diff --git a/lld/ELF/Thunks.cpp b/lld/ELF/Thunks.cpp
index cae3102..55f8170 100644
--- a/lld/ELF/Thunks.cpp
+++ b/lld/ELF/Thunks.cpp
@@ -72,9 +72,7 @@
 
 class ThumbV7ABSLongThunk final : public Thunk {
 public:
-  ThumbV7ABSLongThunk(const SymbolBody &Dest) : Thunk(Dest) {
-    alignment = 2;
-  }
+  ThumbV7ABSLongThunk(const SymbolBody &Dest) : Thunk(Dest) { alignment = 2; }
 
   uint32_t size() const override { return 10; }
   void writeTo(uint8_t *Buf, ThunkSection &IS) const override;
@@ -84,9 +82,7 @@
 
 class ThumbV7PILongThunk final : public Thunk {
 public:
-  ThumbV7PILongThunk(const SymbolBody &Dest) : Thunk(Dest) {
-    alignment = 2;
-  }
+  ThumbV7PILongThunk(const SymbolBody &Dest) : Thunk(Dest) { alignment = 2; }
 
   uint32_t size() const override { return 12; }
   void writeTo(uint8_t *Buf, ThunkSection &IS) const override;
@@ -218,10 +214,10 @@
 // Write MIPS LA25 thunk code to call PIC function from the non-PIC one.
 void MipsThunk::writeTo(uint8_t *Buf, ThunkSection &) const {
   uint64_t S = Destination.getVA();
-  write32(Buf, 0x3c190000, Config->Endianness);                // lui   $25, %hi(func)
+  write32(Buf, 0x3c190000, Config->Endianness); // lui   $25, %hi(func)
   write32(Buf + 4, 0x08000000 | (S >> 2), Config->Endianness); // j     func
-  write32(Buf + 8, 0x27390000, Config->Endianness);            // addiu $25, $25, %lo(func)
-  write32(Buf + 12, 0x00000000, Config->Endianness);           // nop
+  write32(Buf + 8, 0x27390000, Config->Endianness); // addiu $25, $25, %lo(func)
+  write32(Buf + 12, 0x00000000, Config->Endianness); // nop
   Target->relocateOne(Buf, R_MIPS_HI16, S);
   Target->relocateOne(Buf + 8, R_MIPS_LO16, S);
 }
@@ -262,9 +258,7 @@
   fatal("unrecognized relocation type");
 }
 
-static Thunk *addThunkMips(SymbolBody &S) {
-  return make<MipsThunk>(S);
-}
+static Thunk *addThunkMips(SymbolBody &S) { return make<MipsThunk>(S); }
 
 Thunk *addThunk(uint32_t RelocType, SymbolBody &S) {
   if (Config->EMachine == EM_ARM)
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index bf43ee5..680ba93 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -257,7 +257,6 @@
   if (ErrorCount)
     return;
 
-
   // Handle -Map option.
   writeMapFile<ELFT>(OutputSectionCommands);
   if (ErrorCount)
@@ -1392,7 +1391,8 @@
   return nullptr;
 }
 
-template <class ELFT> OutputSection *Writer<ELFT>::findSectionInScript(StringRef Name) {
+template <class ELFT>
+OutputSection *Writer<ELFT>::findSectionInScript(StringRef Name) {
   if (OutputSectionCommand *Cmd = findSectionCommand(Name))
     return Cmd->Sec;
   return nullptr;
diff --git a/lld/ELF/Writer.h b/lld/ELF/Writer.h
index e935b64..7fa56be 100644
--- a/lld/ELF/Writer.h
+++ b/lld/ELF/Writer.h
@@ -55,7 +55,7 @@
                          llvm::StringRef FileName);
 
 bool isMipsN32Abi(const InputFile *F);
-}
-}
+} // namespace elf
+} // namespace lld
 
 #endif