Run clang-format on r197727.

llvm-svn: 197788
diff --git a/lld/lib/ReaderWriter/CoreLinkingContext.cpp b/lld/lib/ReaderWriter/CoreLinkingContext.cpp
index 0d4fb99..2e4d45d 100644
--- a/lld/lib/ReaderWriter/CoreLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/CoreLinkingContext.cpp
@@ -153,8 +153,7 @@
 
 class TestingPassFile : public SimpleFile {
 public:
-  TestingPassFile(const LinkingContext &ctx)
-      : SimpleFile("Testing pass") {}
+  TestingPassFile(const LinkingContext &ctx) : SimpleFile("Testing pass") {}
 
   virtual void addAtom(const Atom &atom) {
     if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(&atom))
@@ -238,10 +237,10 @@
   }
 
   virtual void updateReferenceToGOT(const Reference *ref, bool targetIsNowGOT) {
-    const_cast<Reference *>(ref)->setKindValue(targetIsNowGOT ?
-                                  CoreLinkingContext::TEST_RELOC_PCREL32 : 
-                                  CoreLinkingContext::TEST_RELOC_LEA32_WAS_GOT);
-   }
+    const_cast<Reference *>(ref)->setKindValue(
+        targetIsNowGOT ? CoreLinkingContext::TEST_RELOC_PCREL32
+                       : CoreLinkingContext::TEST_RELOC_LEA32_WAS_GOT);
+  }
 
   virtual const DefinedAtom *makeGOTEntry(const Atom &target) {
     return new TestingGOTAtom(_file, target);
diff --git a/lld/lib/ReaderWriter/ELF/Atoms.h b/lld/lib/ReaderWriter/ELF/Atoms.h
index 8e2d1ca..382e071 100644
--- a/lld/lib/ReaderWriter/ELF/Atoms.h
+++ b/lld/lib/ReaderWriter/ELF/Atoms.h
@@ -40,27 +40,22 @@
   typedef llvm::object::Elf_Rel_Impl<ELFT, false> Elf_Rel;
   typedef llvm::object::Elf_Rel_Impl<ELFT, true> Elf_Rela;
 public:
+  ELFReference(const Elf_Rela *rela, uint64_t off, Reference::KindArch arch,
+               uint16_t relocType, uint32_t idx)
+      : Reference(Reference::KindNamespace::ELF, arch, relocType),
+        _target(nullptr), _targetSymbolIndex(idx), _offsetInAtom(off),
+        _addend(rela->r_addend) {}
 
-  ELFReference(const Elf_Rela *rela, uint64_t off, Reference::KindArch arch, 
-                                              uint16_t relocType, uint32_t idx)
-      : Reference(Reference::KindNamespace::ELF, arch, relocType), 
-        _target(nullptr), _targetSymbolIndex(idx),
-        _offsetInAtom(off), _addend(rela->r_addend) {
-  }
-
-  ELFReference(const Elf_Rel *rel, uint64_t off, Reference::KindArch arch, 
-                                              uint16_t relocType, uint32_t idx)
-      : Reference(Reference::KindNamespace::ELF, arch, relocType), 
-        _target(nullptr), _targetSymbolIndex(idx),
-        _offsetInAtom(off), _addend(0) {
-  }
+  ELFReference(const Elf_Rel *rel, uint64_t off, Reference::KindArch arch,
+               uint16_t relocType, uint32_t idx)
+      : Reference(Reference::KindNamespace::ELF, arch, relocType),
+        _target(nullptr), _targetSymbolIndex(idx), _offsetInAtom(off),
+        _addend(0) {}
 
   ELFReference(uint32_t edgeKind)
-      : Reference(Reference::KindNamespace::all, 
-                  Reference::KindArch::all, edgeKind), 
-        _target(nullptr), _targetSymbolIndex(0), 
-        _offsetInAtom(0), _addend(0) {
-  }
+      : Reference(Reference::KindNamespace::all, Reference::KindArch::all,
+                  edgeKind),
+        _target(nullptr), _targetSymbolIndex(0), _offsetInAtom(0), _addend(0) {}
 
   virtual uint64_t offsetInAtom() const { return _offsetInAtom; }
 
@@ -169,33 +164,19 @@
   typedef llvm::object::Elf_Shdr_Impl<ELFT> Elf_Shdr;
 
 public:
-  ELFDefinedAtom(const ELFFile<ELFT> &file,
-                 StringRef symbolName,
-                 StringRef sectionName,
-                 const Elf_Sym *symbol,
-                 const Elf_Shdr *section,
-                 ArrayRef<uint8_t> contentData,
-                 unsigned int referenceStart,
-                 unsigned int referenceEnd,
-                 std::vector<ELFReference<ELFT>*> &referenceList)
+  ELFDefinedAtom(const ELFFile<ELFT> &file, StringRef symbolName,
+                 StringRef sectionName, const Elf_Sym *symbol,
+                 const Elf_Shdr *section, ArrayRef<uint8_t> contentData,
+                 unsigned int referenceStart, unsigned int referenceEnd,
+                 std::vector<ELFReference<ELFT> *> &referenceList)
+      : _owningFile(file), _symbolName(symbolName), _sectionName(sectionName),
+        _symbol(symbol), _section(section), _contentData(contentData),
+        _referenceStartIndex(referenceStart), _referenceEndIndex(referenceEnd),
+        _referenceList(referenceList), _targetAtomHandler(nullptr),
+        _contentType(typeUnknown), _permissions(permUnknown) {}
 
-    : _owningFile(file)
-    , _symbolName(symbolName)
-    , _sectionName(sectionName)
-    , _symbol(symbol)
-    , _section(section)
-    , _contentData(contentData)
-    , _referenceStartIndex(referenceStart)
-    , _referenceEndIndex(referenceEnd)
-    , _referenceList(referenceList)
-    , _targetAtomHandler(nullptr)
-    , _contentType(typeUnknown)
-    , _permissions(permUnknown) {
-    }
+  ~ELFDefinedAtom() {}
 
-  ~ELFDefinedAtom() {
-  }
-  
   virtual const ELFFile<ELFT> &file() const {
     return _owningFile;
   }
@@ -219,7 +200,7 @@
     // Treat target defined common symbols
     if ((_symbol->st_shndx > llvm::ELF::SHN_LOPROC &&
          _symbol->st_shndx < llvm::ELF::SHN_HIPROC)) {
-      if (!_targetAtomHandler) 
+      if (!_targetAtomHandler)
         _targetAtomHandler = &_owningFile.targetHandler()->targetAtomHandler();
       if (_targetAtomHandler->getType(_symbol) == llvm::ELF::STT_COMMON)
         return (uint64_t) _symbol->st_size;
@@ -255,7 +236,7 @@
     // mergeTentative
     if ((_symbol->st_shndx > llvm::ELF::SHN_LOPROC &&
          _symbol->st_shndx < llvm::ELF::SHN_HIPROC)) {
-      if (!_targetAtomHandler) 
+      if (!_targetAtomHandler)
         _targetAtomHandler = &_owningFile.targetHandler()->targetAtomHandler();
       if (_targetAtomHandler->getType(_symbol) == llvm::ELF::STT_COMMON)
         return mergeAsTentative;
@@ -664,8 +645,8 @@
   virtual ContentType contentType() const {
     if (_symbol->st_shndx >= llvm::ELF::SHN_LORESERVE &&
         _symbol->st_shndx <= llvm::ELF::SHN_HIOS)
-      return _owningFile.targetHandler()->targetAtomHandler().
-                                                  contentType(nullptr, _symbol);
+      return _owningFile.targetHandler()->targetAtomHandler().contentType(
+          nullptr, _symbol);
     return typeZeroFill;
   }
 
@@ -788,41 +769,38 @@
   const Elf_Sym *_symbol;
 };
 
-
 class SimpleELFDefinedAtom : public SimpleDefinedAtom {
 public:
-  SimpleELFDefinedAtom(const File &f) : SimpleDefinedAtom(f) { } 
+  SimpleELFDefinedAtom(const File &f) : SimpleDefinedAtom(f) {}
 
-  void addReferenceELF(Reference::KindArch arch, 
-                    uint16_t kindValue, uint64_t off, const Atom *target,
-                    Reference::Addend addend) {
-    this->addReference(Reference::KindNamespace::ELF, arch, kindValue,
-                       off, target, addend);
+  void addReferenceELF(Reference::KindArch arch, uint16_t kindValue,
+                       uint64_t off, const Atom *target,
+                       Reference::Addend addend) {
+    this->addReference(Reference::KindNamespace::ELF, arch, kindValue, off,
+                       target, addend);
   }
-  
+
   void addReferenceELF_Hexagon(uint16_t relocType, uint64_t off, const Atom *t,
-                                Reference::Addend a) {
+                               Reference::Addend a) {
     this->addReferenceELF(Reference::KindArch::Hexagon, relocType, off, t, a);
   }
-  
+
   void addReferenceELF_x86_64(uint16_t relocType, uint64_t off, const Atom *t,
                               Reference::Addend a) {
     this->addReferenceELF(Reference::KindArch::x86_64, relocType, off, t, a);
   }
-  
+
   void addReferenceELF_PowerPC(uint16_t relocType, uint64_t off, const Atom *t,
                                Reference::Addend a) {
     this->addReferenceELF(Reference::KindArch::PowerPC, relocType, off, t, a);
   }
-  
+
   void addReferenceELF_Mips(uint16_t relocType, uint64_t off, const Atom *t,
-                               Reference::Addend a) {
+                            Reference::Addend a) {
     this->addReferenceELF(Reference::KindArch::Mips, relocType, off, t, a);
   }
 };
 
-
-
 /// \brief Atom which represents an object for which a COPY relocation will be
 ///   generated.
 class ObjectAtom : public SimpleELFDefinedAtom {
@@ -861,8 +839,7 @@
 
 public:
   GOTAtom(const File &f, StringRef secName)
-      : SimpleELFDefinedAtom(f), _section(secName) {
-  }
+      : SimpleELFDefinedAtom(f), _section(secName) {}
 
   virtual Scope scope() const { return scopeTranslationUnit; }
 
@@ -897,8 +874,7 @@
 
 public:
   PLTAtom(const File &f, StringRef secName)
-      : SimpleELFDefinedAtom(f), _section(secName) {
-  }
+      : SimpleELFDefinedAtom(f), _section(secName) {}
 
   virtual Scope scope() const { return scopeTranslationUnit; }
 
@@ -1020,8 +996,7 @@
 
 public:
   InitFiniAtom(const File &f, StringRef secName)
-      : SimpleELFDefinedAtom(f), _section(secName) {
-  }
+      : SimpleELFDefinedAtom(f), _section(secName) {}
 
   virtual Scope scope() const { return scopeGlobal; }
 
diff --git a/lld/lib/ReaderWriter/ELF/DefaultLayout.h b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
index adce4b4..93a6a40 100644
--- a/lld/lib/ReaderWriter/ELF/DefaultLayout.h
+++ b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
@@ -332,12 +332,12 @@
   case DefinedAtom::typeResolver:
   case DefinedAtom::typeCode:
     return llvm::StringSwitch<Layout::SectionOrder>(name)
-      .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
-      .StartsWith(".eh_frame", ORDER_EH_FRAME)
-      .StartsWith(".init", ORDER_INIT)
-      .StartsWith(".fini", ORDER_FINI)
-      .StartsWith(".hash", ORDER_HASH)
-      .Default(ORDER_TEXT);
+        .StartsWith(".eh_frame_hdr", ORDER_EH_FRAMEHDR)
+        .StartsWith(".eh_frame", ORDER_EH_FRAME)
+        .StartsWith(".init", ORDER_INIT)
+        .StartsWith(".fini", ORDER_FINI)
+        .StartsWith(".hash", ORDER_HASH)
+        .Default(ORDER_TEXT);
 
   case DefinedAtom::typeConstant:
     return ORDER_RODATA;
@@ -355,8 +355,8 @@
 
   case DefinedAtom::typeGOT:
     return llvm::StringSwitch<Layout::SectionOrder>(name)
-      .StartsWith(".got.plt", ORDER_GOT_PLT)
-      .Default(ORDER_GOT);
+        .StartsWith(".got.plt", ORDER_GOT_PLT)
+        .Default(ORDER_GOT);
 
   case DefinedAtom::typeStub:
     return ORDER_PLT;
diff --git a/lld/lib/ReaderWriter/ELF/DynamicFile.h b/lld/lib/ReaderWriter/ELF/DynamicFile.h
index cd0f0d5..2ba6dfd 100644
--- a/lld/lib/ReaderWriter/ELF/DynamicFile.h
+++ b/lld/lib/ReaderWriter/ELF/DynamicFile.h
@@ -24,7 +24,7 @@
 namespace elf {
 template <class ELFT> class DynamicFile LLVM_FINAL : public SharedLibraryFile {
 public:
-  static ErrorOr<std::unique_ptr<DynamicFile> >
+  static ErrorOr<std::unique_ptr<DynamicFile>>
   create(std::unique_ptr<llvm::MemoryBuffer> mb, bool useShlibUndefines) {
     std::unique_ptr<DynamicFile> file(
         new DynamicFile(mb->getBufferIdentifier()));
@@ -104,8 +104,7 @@
   }
 
 private:
-  DynamicFile(StringRef name)
-      : SharedLibraryFile(name) {}
+  DynamicFile(StringRef name) : SharedLibraryFile(name) {}
 
   mutable llvm::BumpPtrAllocator _alloc;
   std::unique_ptr<llvm::object::ELFFile<ELFT>> _objFile;
diff --git a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
index f7fd148..d660ca9 100644
--- a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
@@ -35,8 +35,8 @@
   }
 };
 
-ELFLinkingContext::ELFLinkingContext(llvm::Triple triple, 
-                               std::unique_ptr<TargetHandlerBase> targetHandler)
+ELFLinkingContext::ELFLinkingContext(
+    llvm::Triple triple, std::unique_ptr<TargetHandlerBase> targetHandler)
     : _outputELFType(elf::ET_EXEC), _triple(triple),
       _targetHandler(std::move(targetHandler)), _baseAddress(0),
       _isStaticExecutable(false), _noInhibitExec(false),
diff --git a/lld/lib/ReaderWriter/ELF/File.h b/lld/lib/ReaderWriter/ELF/File.h
index 619a09c..dbf8a6f 100644
--- a/lld/lib/ReaderWriter/ELF/File.h
+++ b/lld/lib/ReaderWriter/ELF/File.h
@@ -119,14 +119,14 @@
 
 public:
   ELFFile(StringRef name)
-      : File(name, kindObject), _ordinal(0), 
-          _doStringsMerge(false), _targetHandler(nullptr) {}
+      : File(name, kindObject), _ordinal(0), _doStringsMerge(false),
+        _targetHandler(nullptr) {}
 
   ELFFile(std::unique_ptr<MemoryBuffer> mb, bool atomizeStrings,
           TargetHandlerBase *handler, error_code &ec)
-      : File(mb->getBufferIdentifier(), kindObject),
-        _ordinal(0), _doStringsMerge(atomizeStrings), 
-        _targetHandler(reinterpret_cast<TargetHandler<ELFT>*>(handler)) {
+      : File(mb->getBufferIdentifier(), kindObject), _ordinal(0),
+        _doStringsMerge(atomizeStrings),
+        _targetHandler(reinterpret_cast<TargetHandler<ELFT> *>(handler)) {
     _objFile.reset(new llvm::object::ELFFile<ELFT>(mb.release(), ec));
 
     if (ec)
@@ -162,23 +162,22 @@
 
   Reference::KindArch kindArch() {
     switch (_objFile->getHeader()->e_machine) {
-      case llvm::ELF::EM_X86_64:
-        return Reference::KindArch::x86_64;
-      case llvm::ELF::EM_386:
-        return Reference::KindArch::x86;
-      case llvm::ELF::EM_ARM:
-        return Reference::KindArch::ARM;
-      case llvm::ELF::EM_PPC:
-        return Reference::KindArch::PowerPC;
-      case llvm::ELF::EM_HEXAGON:
-        return Reference::KindArch::Hexagon;
-      case llvm::ELF::EM_MIPS:
-        return Reference::KindArch::Mips;
+    case llvm::ELF::EM_X86_64:
+      return Reference::KindArch::x86_64;
+    case llvm::ELF::EM_386:
+      return Reference::KindArch::x86;
+    case llvm::ELF::EM_ARM:
+      return Reference::KindArch::ARM;
+    case llvm::ELF::EM_PPC:
+      return Reference::KindArch::PowerPC;
+    case llvm::ELF::EM_HEXAGON:
+      return Reference::KindArch::Hexagon;
+    case llvm::ELF::EM_MIPS:
+      return Reference::KindArch::Mips;
     }
     llvm_unreachable("unsupported e_machine value");
   }
 
-
   /// \brief Read input sections and populate necessary data structures
   /// to read them later and create atoms
   error_code createAtomizableSections() {
@@ -510,9 +509,7 @@
     return _absoluteAtoms;
   }
 
-  TargetHandler<ELFT> *targetHandler() const {
-    return _targetHandler;
-  }
+  TargetHandler<ELFT> *targetHandler() const { return _targetHandler; }
 
   Atom *findAtom(const Elf_Sym *symbol) {
     return _symbolToAtomMapping.lookup(symbol);
@@ -536,9 +533,9 @@
           continue;
         bool isMips64EL = _objFile->isMips64EL();
         uint32_t symbolIndex = rai.getSymbol(isMips64EL);
-        auto *ERef = new (_readerStorage)
-            ELFReference<ELFT>(&rai, rai.r_offset - symbol->st_value,
-                              kindArch(), rai.getType(isMips64EL), symbolIndex);
+        auto *ERef = new (_readerStorage) ELFReference<ELFT>(
+            &rai, rai.r_offset - symbol->st_value, kindArch(),
+            rai.getType(isMips64EL), symbolIndex);
         _references.push_back(ERef);
       }
     }
@@ -552,9 +549,9 @@
           continue;
         bool isMips64EL = _objFile->isMips64EL();
         uint32_t symbolIndex = ri.getSymbol(isMips64EL);
-        auto *ERef = new (_readerStorage)
-            ELFReference<ELFT>(&ri, ri.r_offset - symbol->st_value,
-                               kindArch(), ri.getType(isMips64EL), symbolIndex);
+        auto *ERef = new (_readerStorage) ELFReference<ELFT>(
+            &ri, ri.r_offset - symbol->st_value, kindArch(),
+            ri.getType(isMips64EL), symbolIndex);
         // Read the addend from the section contents
         // TODO : We should move the way lld reads relocations totally from
         // ELFFile
@@ -576,7 +573,7 @@
     /// cached value of target relocation handler
     assert(_targetHandler);
     const TargetRelocationHandler<ELFT> &targetRelocationHandler =
-                                        _targetHandler->getRelocationHandler();
+        _targetHandler->getRelocationHandler();
 
     for (auto &ri : _references) {
       if (ri->kindNamespace() == lld::Reference::KindNamespace::ELF) {
@@ -689,7 +686,8 @@
     // not. Let the TargetHandler to make a decision if that's the case.
     if (isTargetSpecificAtom(nullptr, symbol)) {
       assert(_targetHandler);
-      TargetAtomHandler<ELFT> &atomHandler = _targetHandler->targetAtomHandler();
+      TargetAtomHandler<ELFT> &atomHandler =
+          _targetHandler->targetAtomHandler();
       return atomHandler.getType(symbol) == llvm::ELF::STT_COMMON;
     }
     return symbol->getType() == llvm::ELF::STT_COMMON ||
diff --git a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
index 8ab100b..6fb956f 100644
--- a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonLinkingContext.cpp
@@ -77,7 +77,8 @@
     Atom *finiFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
     HexagonFiniAtom *finiAtom =
            (new (_allocator) HexagonFiniAtom(*this, name));
-    finiAtom->addReferenceELF_Hexagon(llvm::ELF::R_HEX_32, 0, finiFunctionAtom, 0);
+    finiAtom->addReferenceELF_Hexagon(llvm::ELF::R_HEX_32, 0, finiFunctionAtom,
+                                      0);
     finiAtom->setOrdinal(_ordinal++);
     addAtom(*finiFunctionAtom);
     addAtom(*finiAtom);
diff --git a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
index c97d70d..85eba35 100644
--- a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
+++ b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonRelocationHandler.h
@@ -31,8 +31,8 @@
   virtual error_code
   applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
                   const lld::AtomLayout &, const Reference &) const;
-                  
- private:
+
+private:
   const HexagonTargetHandler &_targetHandler;
   const HexagonTargetLayout<HexagonELFType> &_targetLayout;
 };
diff --git a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
index cfa17b0..6edd214 100644
--- a/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.cpp
@@ -108,8 +108,7 @@
 
 class ELFPassFile : public SimpleFile {
 public:
-  ELFPassFile(const ELFLinkingContext &eti) 
-    : SimpleFile("ELFPassFile") {
+  ELFPassFile(const ELFLinkingContext &eti) : SimpleFile("ELFPassFile") {
     setOrdinal(eti.getNextOrdinalAndIncrement());
   }
 
@@ -291,8 +290,8 @@
 
   error_code handlePLT32(const Reference &ref) {
     // Turn this into a PC32 to the PLT entry.
-    assert(ref.kindNamespace() ==  Reference::KindNamespace::ELF);
-    assert(ref.kindArch() ==  Reference::KindArch::Hexagon);
+    assert(ref.kindNamespace() == Reference::KindNamespace::ELF);
+    assert(ref.kindArch() == Reference::KindArch::Hexagon);
     const_cast<Reference &>(ref).setKindValue(R_HEX_B22_PCREL);
     const_cast<Reference &>(ref).setTarget(getPLTEntry(ref.target()));
     return error_code::success();
@@ -307,9 +306,8 @@
 }
 
 void HexagonTargetHandler::registerRelocationNames(Registry &registry) {
-  registry.addKindTable(Reference::KindNamespace::ELF, 
-                        Reference::KindArch::Hexagon, 
-                        kindStrings);
+  registry.addKindTable(Reference::KindNamespace::ELF,
+                        Reference::KindArch::Hexagon, kindStrings);
 }
 
 const Registry::KindStrings HexagonTargetHandler::kindStrings[] = {
@@ -407,4 +405,3 @@
   LLD_KIND_STRING_ENTRY(R_HEX_TPREL_11_X),
   LLD_KIND_STRING_END
 };
-
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
index 64cce0d..2a3c896 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsTargetHandler.cpp
@@ -175,20 +175,13 @@
 }
 
 void MipsTargetHandler::registerRelocationNames(Registry &registry) {
-  registry.addKindTable(Reference::KindNamespace::ELF, 
-                        Reference::KindArch::Mips, 
-                        kindStrings);
+  registry.addKindTable(Reference::KindNamespace::ELF,
+                        Reference::KindArch::Mips, kindStrings);
 }
 
-
 const Registry::KindStrings MipsTargetHandler::kindStrings[] = {
-  LLD_KIND_STRING_ENTRY(R_MIPS_NONE),
-  LLD_KIND_STRING_ENTRY(R_MIPS_32),
-  LLD_KIND_STRING_ENTRY(R_MIPS_HI16),
-  LLD_KIND_STRING_ENTRY(R_MIPS_LO16),
-  LLD_KIND_STRING_ENTRY(R_MIPS_GOT16),
-  LLD_KIND_STRING_ENTRY(R_MIPS_CALL16),
-  LLD_KIND_STRING_ENTRY(R_MIPS_JALR),
-  LLD_KIND_STRING_END
+  LLD_KIND_STRING_ENTRY(R_MIPS_NONE),  LLD_KIND_STRING_ENTRY(R_MIPS_32),
+  LLD_KIND_STRING_ENTRY(R_MIPS_HI16),  LLD_KIND_STRING_ENTRY(R_MIPS_LO16),
+  LLD_KIND_STRING_ENTRY(R_MIPS_GOT16), LLD_KIND_STRING_ENTRY(R_MIPS_CALL16),
+  LLD_KIND_STRING_ENTRY(R_MIPS_JALR),  LLD_KIND_STRING_END
 };
- 
\ No newline at end of file
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp b/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
index 7f72c8c..d5a9480 100644
--- a/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.cpp
@@ -67,11 +67,9 @@
     : DefaultTargetHandler(targetInfo), _relocationHandler(targetInfo),
       _targetLayout(targetInfo) {}
 
-
 void PPCTargetHandler::registerRelocationNames(Registry &registry) {
-  registry.addKindTable(Reference::KindNamespace::ELF, 
-                        Reference::KindArch::PowerPC, 
-                        kindStrings);
+  registry.addKindTable(Reference::KindNamespace::ELF,
+                        Reference::KindArch::PowerPC, kindStrings);
 }
 
 const Registry::KindStrings PPCTargetHandler::kindStrings[] = {
@@ -130,6 +128,3 @@
   LLD_KIND_STRING_ENTRY(R_PPC_REL16_HA),
   LLD_KIND_STRING_END
 };
-
-
-
diff --git a/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h b/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
index 426a76c..8f1de5c 100644
--- a/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
+++ b/lld/lib/ReaderWriter/ELF/PPC/PPCTargetHandler.h
@@ -35,10 +35,8 @@
   PPCTargetHandler(PPCLinkingContext &targetInfo);
 
   virtual void registerRelocationNames(Registry &registry);
-  
-  virtual TargetLayout<PPCELFType> &targetLayout() {
-    return _targetLayout;
-  }
+
+  virtual TargetLayout<PPCELFType> &targetLayout() { return _targetLayout; }
 
   virtual const PPCTargetRelocationHandler &getRelocationHandler() const {
     return _relocationHandler;
diff --git a/lld/lib/ReaderWriter/ELF/Reader.cpp b/lld/lib/ReaderWriter/ELF/Reader.cpp
index 43993ca..ccfd8ab 100644
--- a/lld/lib/ReaderWriter/ELF/Reader.cpp
+++ b/lld/lib/ReaderWriter/ELF/Reader.cpp
@@ -56,8 +56,8 @@
   typedef llvm::ErrorOr<std::unique_ptr<lld::SharedLibraryFile>> result_type;
 
   template <class ELFT>
-  static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb, 
-                                                            bool useUndefines) {
+  static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
+                            bool useUndefines) {
     return lld::elf::DynamicFile<ELFT>::create(std::move(mb), useUndefines);
   }
 };
@@ -67,81 +67,81 @@
 
   template <class ELFT>
   static result_type create(std::unique_ptr<llvm::MemoryBuffer> mb,
-                            bool atomizeStrings,
-                            TargetHandlerBase *handler,
+                            bool atomizeStrings, TargetHandlerBase *handler,
                             lld::error_code &ec) {
-    return std::unique_ptr<lld::File>(
-        new lld::elf::ELFFile<ELFT>(std::move(mb), atomizeStrings, handler,ec));
+    return std::unique_ptr<lld::File>(new lld::elf::ELFFile<ELFT>(
+        std::move(mb), atomizeStrings, handler, ec));
   }
 };
 
 class ELFObjectReader : public Reader {
 public:
-  ELFObjectReader(bool atomizeStrings, TargetHandlerBase* handler) 
-    : _atomizeStrings(atomizeStrings), _handler(handler) { }
+  ELFObjectReader(bool atomizeStrings, TargetHandlerBase *handler)
+      : _atomizeStrings(atomizeStrings), _handler(handler) {}
 
-  virtual bool canParse(file_magic magic, StringRef,const MemoryBuffer&) const {
+  virtual bool canParse(file_magic magic, StringRef,
+                        const MemoryBuffer &) const {
     return (magic == llvm::sys::fs::file_magic::elf_relocatable);
   }
-  
+
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
             std::vector<std::unique_ptr<File>> &result) const {
     error_code ec;
     std::size_t maxAlignment =
-              1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
+        1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
     std::unique_ptr<File> f(createELF<ELFFileCreateELFTraits>(
-                       getElfArchType(&*mb), maxAlignment, std::move(mb), 
-                       _atomizeStrings, _handler, ec));
+        getElfArchType(&*mb), maxAlignment, std::move(mb), _atomizeStrings,
+        _handler, ec));
     if (ec)
       return ec;
     result.push_back(std::move(f));
     return error_code::success();
   }
+
 private:
-  bool               _atomizeStrings;
+  bool _atomizeStrings;
   TargetHandlerBase *_handler;
 };
 
-
 class ELFDSOReader : public Reader {
 public:
-  ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) { }
+  ELFDSOReader(bool useUndefines) : _useUndefines(useUndefines) {}
 
-  virtual bool canParse(file_magic magic, StringRef, const MemoryBuffer&) const{
+  virtual bool canParse(file_magic magic, StringRef,
+                        const MemoryBuffer &) const {
     return (magic == llvm::sys::fs::file_magic::elf_shared_object);
   }
-  
+
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
             std::vector<std::unique_ptr<File>> &result) const {
     std::size_t maxAlignment =
-              1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
-    auto f = createELF<DynamicFileCreateELFTraits>( 
-                                            getElfArchType(&*mb), maxAlignment, 
-                                            std::move(mb), _useUndefines);
+        1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
+    auto f = createELF<DynamicFileCreateELFTraits>(
+        getElfArchType(&*mb), maxAlignment, std::move(mb), _useUndefines);
     if (!f)
-      return f;   
+      return f;
     result.push_back(std::move(*f));
     return error_code::success();
   }
+
 private:
   bool _useUndefines;
 };
 
 } // anonymous
 
-
-// This dynamic registration of a handler causes support for all ELF 
-// architectures to be pulled into the linker.  If we want to support making a 
+// This dynamic registration of a handler causes support for all ELF
+// architectures to be pulled into the linker.  If we want to support making a
 // linker that only supports one ELF architecture, we'd need to change this
 // to have a different registration method for each architecture.
-void Registry::addSupportELFObjects(bool atomizeStrings, 
-                                                 TargetHandlerBase *handler) {
+void Registry::addSupportELFObjects(bool atomizeStrings,
+                                    TargetHandlerBase *handler) {
 
   // Tell registry about the ELF object file parser.
   add(std::unique_ptr<Reader>(new ELFObjectReader(atomizeStrings, handler)));
-  
+
   // Tell registry about the relocation name to number mapping for this arch.
   handler->registerRelocationNames(*this);
 }
@@ -150,5 +150,4 @@
   add(std::unique_ptr<Reader>(new ELFDSOReader(useShlibUndefines)));
 }
 
-
 } // end namespace lld
diff --git a/lld/lib/ReaderWriter/ELF/SectionChunks.h b/lld/lib/ReaderWriter/ELF/SectionChunks.h
index ae7fed2..bcdcd90 100644
--- a/lld/lib/ReaderWriter/ELF/SectionChunks.h
+++ b/lld/lib/ReaderWriter/ELF/SectionChunks.h
@@ -42,7 +42,7 @@
 public:
   Section(const ELFLinkingContext &context, StringRef name,
           typename Chunk<ELFT>::Kind k = Chunk<ELFT>::Kind::ELFSection)
-      : Chunk<ELFT>(name, k, context), _parent(nullptr), _flags(0), _entSize(0), 
+      : Chunk<ELFT>(name, k, context), _parent(nullptr), _flags(0), _entSize(0),
         _type(0), _link(0), _info(0), _segmentType(SHT_NULL) {}
 
   /// \brief Modify the section contents before assigning virtual addresses
@@ -961,12 +961,12 @@
         r->r_addend =
             writer->addressOfAtom(rel.second->target()) + rel.second->addend();
       dest += sizeof(Elf_Rela);
-      DEBUG_WITH_TYPE(
-          "ELFRelocationTable", 
-          llvm::dbgs() << rel.second->kindValue() << " relocation at "
-                       << rel.first->name() << "@" << r->r_offset << " to "
-                       << rel.second->target()->name() << "@" << r->r_addend
-                       << "\n";);
+      DEBUG_WITH_TYPE("ELFRelocationTable",
+                      llvm::dbgs() << rel.second->kindValue()
+                                   << " relocation at " << rel.first->name()
+                                   << "@" << r->r_offset << " to "
+                                   << rel.second->target()->name() << "@"
+                                   << r->r_addend << "\n";);
     }
   }
 
diff --git a/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp b/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
index 3e64a73..ba66416 100644
--- a/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.cpp
@@ -31,8 +31,6 @@
   return 0;
 }
 
-
-
 const Registry::KindStrings X86TargetHandler::kindStrings[] = {
   LLD_KIND_STRING_ENTRY(R_386_NONE),
   LLD_KIND_STRING_ENTRY(R_386_32),
@@ -79,8 +77,7 @@
 };
 
 void X86TargetHandler::registerRelocationNames(Registry &registry) {
-  registry.addKindTable(Reference::KindNamespace::ELF, 
-                        Reference::KindArch::x86, 
+  registry.addKindTable(Reference::KindNamespace::ELF, Reference::KindArch::x86,
                         kindStrings);
 }
 
diff --git a/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.h b/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
index 137190d..86fbeac 100644
--- a/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
+++ b/lld/lib/ReaderWriter/ELF/X86/X86TargetHandler.h
@@ -29,9 +29,8 @@
   virtual error_code applyRelocation(ELFWriter &, llvm::FileOutputBuffer &,
                                      const lld::AtomLayout &,
                                      const Reference &) const;
-                                     
-  static const Registry::KindStrings kindStrings[];
 
+  static const Registry::KindStrings kindStrings[];
 };
 
 class X86TargetHandler LLVM_FINAL
@@ -41,9 +40,7 @@
 
   virtual void registerRelocationNames(Registry &registry);
 
-  virtual TargetLayout<X86ELFType> &targetLayout() {
-    return _targetLayout;
-  }
+  virtual TargetLayout<X86ELFType> &targetLayout() { return _targetLayout; }
 
   virtual const X86TargetRelocationHandler &getRelocationHandler() const {
     return _relocationHandler;
diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
index 056a3ea..69e7924 100644
--- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
+++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64LinkingContext.cpp
@@ -69,7 +69,7 @@
     Atom *initFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
     X86_64InitAtom *initAtom =
            (new (_allocator) X86_64InitAtom(*this, name));
-    initAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0, 
+    initAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0,
                                      initFunctionAtom, 0);
     initAtom->setOrdinal(_ordinal++);
     addAtom(*initFunctionAtom);
@@ -80,8 +80,8 @@
     Atom *finiFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
     X86_64FiniAtom *finiAtom =
            (new (_allocator) X86_64FiniAtom(*this, name));
-    finiAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0, 
-                                    finiFunctionAtom, 0);
+    finiAtom->addReferenceELF_x86_64(llvm::ELF::R_X86_64_64, 0,
+                                     finiFunctionAtom, 0);
     finiAtom->setOrdinal(_ordinal++);
     addAtom(*finiFunctionAtom);
     addAtom(*finiAtom);
diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
index a8f703a..bab665c 100644
--- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64RelocationHandler.cpp
@@ -47,8 +47,6 @@
   // TODO: Make sure that the result sign extends to the 64bit value.
 }
 
-
-
 int64_t X86_64TargetRelocationHandler::relocAddend(const Reference &ref) const {
   if (ref.kindNamespace() != Reference::KindNamespace::ELF)
     return false;
@@ -94,7 +92,7 @@
   case R_X86_64_TPOFF32: {
     _tlsSize =
         _context.getTargetHandler<X86_64ELFType>().targetLayout().getTLSSize();
-    if (ref.kindValue() == R_X86_64_TPOFF32 || 
+    if (ref.kindValue() == R_X86_64_TPOFF32 ||
         ref.kindValue() == R_X86_64_DTPOFF32) {
       int32_t result = (int32_t)(targetVAddress - _tlsSize);
       *reinterpret_cast<llvm::support::little32_t *>(location) = result;
diff --git a/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp b/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
index c9b2bec..a553b2d 100644
--- a/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
+++ b/lld/lib/ReaderWriter/ELF/X86_64/X86_64TargetHandler.cpp
@@ -29,9 +29,8 @@
 }
 
 void X86_64TargetHandler::registerRelocationNames(Registry &registry) {
-  registry.addKindTable(Reference::KindNamespace::ELF, 
-                        Reference::KindArch::x86_64, 
-                        kindStrings);
+  registry.addKindTable(Reference::KindNamespace::ELF,
+                        Reference::KindArch::x86_64, kindStrings);
 }
 
 const Registry::KindStrings X86_64TargetHandler::kindStrings[] = {
@@ -76,4 +75,3 @@
   LLD_KIND_STRING_ENTRY(LLD_R_X86_64_GOTRELINDEX),
   LLD_KIND_STRING_END
 };
-
diff --git a/lld/lib/ReaderWriter/FileArchive.cpp b/lld/lib/ReaderWriter/FileArchive.cpp
index 471916d..f28cc4e 100644
--- a/lld/lib/ReaderWriter/FileArchive.cpp
+++ b/lld/lib/ReaderWriter/FileArchive.cpp
@@ -34,20 +34,19 @@
 /// \brief The FileArchive class represents an Archive Library file
 class FileArchive : public lld::ArchiveLibraryFile {
 public:
-
-  virtual ~FileArchive() { }
+  virtual ~FileArchive() {}
 
   /// \brief Check if any member of the archive contains an Atom with the
   /// specified name and return the File object for that member, or nullptr.
   virtual const File *find(StringRef name, bool dataSymbolOnly) const {
     auto member = _symbolMemberMap.find(name);
-    if (member == _symbolMemberMap.end()) 
+    if (member == _symbolMemberMap.end())
       return nullptr;
     Archive::child_iterator ci = member->second;
 
-   // Don't return a member already returned
+    // Don't return a member already returned
     const char *memberStart = ci->getBuffer().data();
-    if (_membersInstantiated.count(memberStart)) 
+    if (_membersInstantiated.count(memberStart))
       return nullptr;
 
     if (dataSymbolOnly) {
@@ -72,10 +71,10 @@
 
   /// \brief parse each member
   virtual error_code
-    parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
-    for (auto mf = _archive->begin_children(),
-              me = _archive->end_children(); mf != me; ++mf) {
-      if (error_code ec=instantiateMember(mf, result))
+  parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
+    for (auto mf = _archive->begin_children(), me = _archive->end_children();
+         mf != me; ++mf) {
+      if (error_code ec = instantiateMember(mf, result))
         return ec;
     }
     return error_code::success();
@@ -98,10 +97,11 @@
   }
 
 protected:
-  error_code instantiateMember(Archive::child_iterator member,
-                             std::vector<std::unique_ptr<File>> &result) const {
+  error_code
+  instantiateMember(Archive::child_iterator member,
+                    std::vector<std::unique_ptr<File>> &result) const {
     OwningPtr<MemoryBuffer> buff;
-    if (error_code ec=member->getMemoryBuffer(buff, true))
+    if (error_code ec = member->getMemoryBuffer(buff, true))
       return ec;
     if (_logLoading)
       llvm::outs() << buff->getBufferIdentifier() << "\n";
@@ -112,10 +112,8 @@
     return error_code::success();
   }
 
-
   error_code isDataSymbol(MemoryBuffer *mb, StringRef symbol) const {
-    std::unique_ptr<ObjectFile>
-                    obj(ObjectFile::createObjectFile(mb));
+    std::unique_ptr<ObjectFile> obj(ObjectFile::createObjectFile(mb));
     error_code ec;
     SymbolRef::Type symtype;
     uint32_t symflags;
@@ -124,22 +122,26 @@
     StringRef symbolname;
 
     for (symbol_iterator i = ibegin; i != iend; i.increment(ec)) {
-      if (ec) return ec;
+      if (ec)
+        return ec;
 
       // Get symbol name
-      if ((ec = (i->getName(symbolname)))) return ec;
+      if ((ec = (i->getName(symbolname))))
+        return ec;
 
       if (symbolname != symbol)
-          continue;
+        continue;
 
       // Get symbol flags
-      if ((ec = (i->getFlags(symflags)))) return ec;
+      if ((ec = (i->getFlags(symflags))))
+        return ec;
 
       if (symflags <= SymbolRef::SF_Undefined)
-          continue;
+        continue;
 
       // Get Symbol Type
-      if ((ec = (i->getType(symtype)))) return ec;
+      if ((ec = (i->getType(symtype))))
+        return ec;
 
       if (symtype == SymbolRef::ST_Data) {
         return error_code::success();
@@ -149,40 +151,34 @@
   }
 
 private:
-  typedef std::unordered_map<StringRef,Archive::child_iterator> MemberMap;
-  typedef std::set<const char*> InstantiatedSet;
+  typedef std::unordered_map<StringRef, Archive::child_iterator> MemberMap;
+  typedef std::set<const char *> InstantiatedSet;
 
-  const Registry                           &_registry;
-  std::unique_ptr<Archive>                  _archive;
-  mutable MemberMap                         _symbolMemberMap;
-  mutable InstantiatedSet                   _membersInstantiated;
-  atom_collection_vector<DefinedAtom>       _definedAtoms;
-  atom_collection_vector<UndefinedAtom>     _undefinedAtoms;
+  const Registry &_registry;
+  std::unique_ptr<Archive> _archive;
+  mutable MemberMap _symbolMemberMap;
+  mutable InstantiatedSet _membersInstantiated;
+  atom_collection_vector<DefinedAtom> _definedAtoms;
+  atom_collection_vector<UndefinedAtom> _undefinedAtoms;
   atom_collection_vector<SharedLibraryAtom> _sharedLibraryAtoms;
-  atom_collection_vector<AbsoluteAtom>      _absoluteAtoms;
-  bool                                      _isWholeArchive;
-  bool                                      _logLoading;
+  atom_collection_vector<AbsoluteAtom> _absoluteAtoms;
+  bool _isWholeArchive;
+  bool _logLoading;
 
 public:
   /// only subclasses of ArchiveLibraryFile can be instantiated
-  FileArchive(const Registry &registry,
-              Archive* archive,
-              StringRef path,
-              bool isWholeArchive,
-              bool logLoading)
-      : ArchiveLibraryFile(path),
-        _registry(registry),
-        _archive(std::move(archive)),
-        _isWholeArchive(isWholeArchive),
-        _logLoading(logLoading) {
-  }
+  FileArchive(const Registry &registry, Archive *archive, StringRef path,
+              bool isWholeArchive, bool logLoading)
+      : ArchiveLibraryFile(path), _registry(registry),
+        _archive(std::move(archive)), _isWholeArchive(isWholeArchive),
+        _logLoading(logLoading) {}
 
   error_code buildTableOfContents() {
-    DEBUG_WITH_TYPE("FileArchive",
-                    llvm::dbgs() << "Table of contents for archive '"
-                                 << _archive->getFileName() << "':\n");
+    DEBUG_WITH_TYPE("FileArchive", llvm::dbgs()
+                                       << "Table of contents for archive '"
+                                       << _archive->getFileName() << "':\n");
     for (auto i = _archive->begin_symbols(), e = _archive->end_symbols();
-              i != e; ++i) {
+         i != e; ++i) {
       StringRef name;
       error_code ec;
       Archive::child_iterator member;
@@ -190,56 +186,55 @@
         return ec;
       if ((ec = i->getMember(member)))
         return ec;
-      DEBUG_WITH_TYPE("FileArchive",
-           llvm::dbgs() << llvm::format("0x%08llX ", member->getBuffer().data())
-                        << "'" << name << "'\n");
+      DEBUG_WITH_TYPE(
+          "FileArchive",
+          llvm::dbgs() << llvm::format("0x%08llX ", member->getBuffer().data())
+                       << "'" << name << "'\n");
       _symbolMemberMap[name] = member;
     }
-    return error_code::success();  
+    return error_code::success();
   }
 
 }; // class FileArchive
 
-
-
 class ArchiveReader : public Reader {
 public:
-  ArchiveReader(bool logLoading) : _logLoading(logLoading) { }
-  
-  virtual bool canParse(file_magic magic, StringRef, const MemoryBuffer&) const{
+  ArchiveReader(bool logLoading) : _logLoading(logLoading) {}
+
+  virtual bool canParse(file_magic magic, StringRef,
+                        const MemoryBuffer &) const {
     return (magic == llvm::sys::fs::file_magic::archive);
   }
-  
+
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry &reg,
             std::vector<std::unique_ptr<File>> &result) const {
     // Make Archive object which will be owned by FileArchive object.
     error_code ec;
-    Archive* archive = new Archive(mb.get(), ec);
+    Archive *archive = new Archive(mb.get(), ec);
     if (ec)
       return ec;
     StringRef path = mb->getBufferIdentifier();
     // Construct FileArchive object.
-    std::unique_ptr<FileArchive> file(new FileArchive(reg, archive, 
-                                                     path, false, _logLoading));
+    std::unique_ptr<FileArchive> file(
+        new FileArchive(reg, archive, path, false, _logLoading));
     ec = file->buildTableOfContents();
     if (ec)
       return ec;
-      
+
     // Transfer ownership of memory buffer to Archive object.
     mb.release();
-    
+
     result.push_back(std::move(file));
-    return error_code::success();     
+    return error_code::success();
   }
+
 private:
-  bool  _logLoading;
+  bool _logLoading;
 };
 
-
 } // anonymous namespace
 
-
 void Registry::addSupportArchives(bool logLoading) {
   add(std::unique_ptr<Reader>(new ArchiveReader(logLoading)));
 }
diff --git a/lld/lib/ReaderWriter/MachO/ExecutableAtoms.hpp b/lld/lib/ReaderWriter/MachO/ExecutableAtoms.hpp
index ecc89f3..144baf7 100644
--- a/lld/lib/ReaderWriter/MachO/ExecutableAtoms.hpp
+++ b/lld/lib/ReaderWriter/MachO/ExecutableAtoms.hpp
@@ -29,9 +29,8 @@
 //
 class CRuntimeFile : public SimpleFile {
 public:
-    CRuntimeFile(const MachOLinkingContext &context)
-      : SimpleFile("C runtime"),
-        _undefMain(*this, context.entrySymbolName()) {
+  CRuntimeFile(const MachOLinkingContext &context)
+      : SimpleFile("C runtime"), _undefMain(*this, context.entrySymbolName()) {
       // only main executables need _main
       if (context.outputFileType() == llvm::MachO::MH_EXECUTE) {
         this->addAtom(_undefMain);
diff --git a/lld/lib/ReaderWriter/MachO/GOTPass.hpp b/lld/lib/ReaderWriter/MachO/GOTPass.hpp
index af8fce7..4342b3e 100644
--- a/lld/lib/ReaderWriter/MachO/GOTPass.hpp
+++ b/lld/lib/ReaderWriter/MachO/GOTPass.hpp
@@ -29,7 +29,7 @@
     return true;
   }
 
-  virtual bool isGOTAccess(const Reference&, bool& canBypassGOT) {
+  virtual bool isGOTAccess(const Reference &, bool &canBypassGOT) {
     return false;
   }
 
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 6f29a4d..1c91609 100644
--- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -100,7 +100,6 @@
   return "<unknown>";
 }
 
-
 uint32_t MachOLinkingContext::cpuTypeFromArch(Arch arch) {
   assert(arch != arch_unknown);
   for (ArchInfo *info = _s_archInfos; !info->archName.empty(); ++info) {
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
index 211f337..f2f6cf8 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFile.h
@@ -259,7 +259,7 @@
 
 
 /// Takes in-memory normalized dylib or object and parses it into lld::File
-ErrorOr<std::unique_ptr<lld::File>> 
+ErrorOr<std::unique_ptr<lld::File>>
 normalizedToAtoms(const NormalizedFile &normalizedFile, StringRef path);
 
 /// Takes atoms and generates a normalized macho-o view.
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
index 8baac9a..5fb2802 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
@@ -312,20 +312,17 @@
   MachOLinkingContext::Arch arch = MachOLinkingContext::archFromName(archName);
   switch (arch) {
   case MachOLinkingContext::arch_x86_64:
-    addKindTable(Reference::KindNamespace::mach_o, 
-                 Reference::KindArch::x86_64, 
+    addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::x86_64,
                  mach_o::KindHandler_x86_64::kindStrings);
     break;
   case MachOLinkingContext::arch_x86:
-    addKindTable(Reference::KindNamespace::mach_o, 
-                 Reference::KindArch::x86, 
+    addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::x86,
                  mach_o::KindHandler_x86::kindStrings);
     break;
   case MachOLinkingContext::arch_armv6:
   case MachOLinkingContext::arch_armv7:
   case MachOLinkingContext::arch_armv7s:
-    addKindTable(Reference::KindNamespace::mach_o, 
-                 Reference::KindArch::ARM, 
+    addKindTable(Reference::KindNamespace::mach_o, Reference::KindArch::ARM,
                  mach_o::KindHandler_arm::kindStrings);
     break;
   default:
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
index 34e3f31..847018b 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
@@ -436,10 +436,9 @@
       if ( ref->target() != nullptr )
         targetAddress = _atomToAddress[ref->target()];
       uint64_t fixupAddress = _atomToAddress[ai.atom] + offset;
-      _context.kindHandler().applyFixup(ref->kindNamespace(), ref->kindArch(), 
-                                       ref->kindValue(), ref->addend(),
-                                       &atomContent[offset], fixupAddress,
-                                       targetAddress);
+      _context.kindHandler().applyFixup(
+          ref->kindNamespace(), ref->kindArch(), ref->kindValue(),
+          ref->addend(), &atomContent[offset], fixupAddress, targetAddress);
     }
   }
 }
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
index d49fbb3..e5c4a8b 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
@@ -304,7 +304,7 @@
 template <>
 struct ScalarEnumerationTraits<RelocationInfoType> {
   static void enumeration(IO &io, RelocationInfoType &value) {
-    YamlContext *info = reinterpret_cast<YamlContext*>(io.getContext());
+    YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
     assert(info != nullptr);
     NormalizedFile *file = info->_normalizeMachOFile;
     assert(file != nullptr);
diff --git a/lld/lib/ReaderWriter/MachO/ReferenceKinds.cpp b/lld/lib/ReaderWriter/MachO/ReferenceKinds.cpp
index 8d25150..0e87fb5 100644
--- a/lld/lib/ReaderWriter/MachO/ReferenceKinds.cpp
+++ b/lld/lib/ReaderWriter/MachO/ReferenceKinds.cpp
@@ -55,22 +55,21 @@
 KindHandler_x86_64::~KindHandler_x86_64() {
 }
 
-
 const Registry::KindStrings KindHandler_x86_64::kindStrings[] = {
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_UNSIGNED),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_BRANCH),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_1),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_2),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_4),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT_LOAD),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT),
-    LLD_KIND_STRING_ENTRY(X86_64_RELOC_TLV),
-    LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA),
-    LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_TLV_NOW_LEA),
-    LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_TARGET),
-    LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_IMMEDIATE),
-    LLD_KIND_STRING_END
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_UNSIGNED),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_BRANCH),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_1),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_2),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_SIGNED_4),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT_LOAD),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_GOT),
+  LLD_KIND_STRING_ENTRY(X86_64_RELOC_TLV),
+  LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA),
+  LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_TLV_NOW_LEA),
+  LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_TARGET),
+  LLD_KIND_STRING_ENTRY(LLD_X86_64_RELOC_LAZY_IMMEDIATE),
+  LLD_KIND_STRING_END
 };
 
 bool KindHandler_x86_64::isCallSite(const Reference &ref) {
@@ -89,54 +88,53 @@
   return (ref.kindValue() == LLD_X86_64_RELOC_LAZY_TARGET);
 }
 
-
-void KindHandler_x86_64::applyFixup(Reference::KindNamespace ns, 
-                                    Reference::KindArch arch, 
-                                    Reference::KindValue kindValue, 
-                                    uint64_t addend,
-                                    uint8_t *location, uint64_t fixupAddress,
+void KindHandler_x86_64::applyFixup(Reference::KindNamespace ns,
+                                    Reference::KindArch arch,
+                                    Reference::KindValue kindValue,
+                                    uint64_t addend, uint8_t *location,
+                                    uint64_t fixupAddress,
                                     uint64_t targetAddress) {
   if (ns != Reference::KindNamespace::mach_o)
     return;
   assert(arch == Reference::KindArch::x86_64);
   int32_t *loc32 = reinterpret_cast<int32_t*>(location);
   uint64_t* loc64 = reinterpret_cast<uint64_t*>(location);
-  switch ( kindValue ) {
-    case X86_64_RELOC_BRANCH:
-    case X86_64_RELOC_SIGNED:
-    case X86_64_RELOC_GOT_LOAD:
-    case X86_64_RELOC_GOT:
-    case X86_64_RELOC_TLV:
+  switch (kindValue) {
+  case X86_64_RELOC_BRANCH:
+  case X86_64_RELOC_SIGNED:
+  case X86_64_RELOC_GOT_LOAD:
+  case X86_64_RELOC_GOT:
+  case X86_64_RELOC_TLV:
       *loc32 = (targetAddress - (fixupAddress+4)) + addend;
       break;
-    case X86_64_RELOC_UNSIGNED:
+  case X86_64_RELOC_UNSIGNED:
       *loc64 = targetAddress + addend;
       break;
-    case X86_64_RELOC_SIGNED_1:
+  case X86_64_RELOC_SIGNED_1:
       *loc32 = (targetAddress - (fixupAddress+5)) + addend;
       break;
-    case X86_64_RELOC_SIGNED_2:
+  case X86_64_RELOC_SIGNED_2:
       *loc32 = (targetAddress - (fixupAddress+6)) + addend;
       break;
-    case X86_64_RELOC_SIGNED_4:
+  case X86_64_RELOC_SIGNED_4:
       *loc32 = (targetAddress - (fixupAddress+8)) + addend;
       break;
-    case LLD_X86_64_RELOC_SIGNED_32:
+  case LLD_X86_64_RELOC_SIGNED_32:
       *loc32 = (targetAddress - fixupAddress) + addend;
       break;
-    case LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA:
-    case LLD_X86_64_RELOC_TLV_NOW_LEA:
+  case LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA:
+  case LLD_X86_64_RELOC_TLV_NOW_LEA:
       // Change MOVQ to LEA
       assert(location[-2] == 0x8B);
       location[-2] = 0x8D;
       *loc32 = (targetAddress - (fixupAddress+4)) + addend;
       break;
-    case LLD_X86_64_RELOC_LAZY_TARGET:
-    case LLD_X86_64_RELOC_LAZY_IMMEDIATE:
+  case LLD_X86_64_RELOC_LAZY_TARGET:
+  case LLD_X86_64_RELOC_LAZY_IMMEDIATE:
       // do nothing
       break;
-    default:
-      llvm_unreachable("invalid x86_64 Reference Kind");
+  default:
+    llvm_unreachable("invalid x86_64 Reference Kind");
       break;
   }
 }
@@ -150,13 +148,13 @@
 }
 
 const Registry::KindStrings KindHandler_x86::kindStrings[] = {
-    LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_BRANCH32),
-    LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_ABS32),
-    LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_FUNC_REL32),
-    LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_POINTER32),
-    LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_TARGET),
-    LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_IMMEDIATE),
-    LLD_KIND_STRING_END
+  LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_BRANCH32),
+  LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_ABS32),
+  LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_FUNC_REL32),
+  LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_POINTER32),
+  LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_TARGET),
+  LLD_KIND_STRING_ENTRY(LLD_X86_RELOC_LAZY_IMMEDIATE),
+  LLD_KIND_STRING_END
 };
 
 bool KindHandler_x86::isCallSite(const Reference &ref) {
@@ -167,44 +165,41 @@
   return (ref.kindValue() == LLD_X86_RELOC_POINTER32);
 }
 
-
 bool KindHandler_x86::isLazyImmediate(const Reference &ref) {
   return (ref.kindValue() == LLD_X86_RELOC_LAZY_TARGET);
 }
 
-
 bool KindHandler_x86::isLazyTarget(const Reference &ref) {
   return (ref.kindValue() == LLD_X86_RELOC_LAZY_TARGET);
 }
 
-
-void KindHandler_x86::applyFixup(Reference::KindNamespace ns, 
-                                 Reference::KindArch arch, 
-                                 Reference::KindValue kindValue, 
+void KindHandler_x86::applyFixup(Reference::KindNamespace ns,
+                                 Reference::KindArch arch,
+                                 Reference::KindValue kindValue,
                                  uint64_t addend, uint8_t *location,
-                                 uint64_t fixupAddress, 
+                                 uint64_t fixupAddress,
                                  uint64_t targetAddress) {
   if (ns != Reference::KindNamespace::mach_o)
     return;
   assert(arch == Reference::KindArch::x86);
   int32_t *loc32 = reinterpret_cast<int32_t*>(location);
   switch (kindValue) {
-    case LLD_X86_RELOC_BRANCH32:
+  case LLD_X86_RELOC_BRANCH32:
       *loc32 = (targetAddress - (fixupAddress+4)) + addend;
       break;
-    case LLD_X86_RELOC_POINTER32:
-    case LLD_X86_RELOC_ABS32:
+  case LLD_X86_RELOC_POINTER32:
+  case LLD_X86_RELOC_ABS32:
       *loc32 = targetAddress + addend;
       break;
-    case LLD_X86_RELOC_FUNC_REL32:
+  case LLD_X86_RELOC_FUNC_REL32:
       *loc32 = targetAddress + addend;
       break;
-    case LLD_X86_RELOC_LAZY_TARGET:
-    case LLD_X86_RELOC_LAZY_IMMEDIATE:
+  case LLD_X86_RELOC_LAZY_TARGET:
+  case LLD_X86_RELOC_LAZY_IMMEDIATE:
       // do nothing
       break;
-    default:
-      llvm_unreachable("invalid x86 Reference Kind");
+  default:
+    llvm_unreachable("invalid x86 Reference Kind");
       break;
   }
 }
@@ -218,21 +213,21 @@
 }
 
 const Registry::KindStrings KindHandler_arm::kindStrings[] = {
-    LLD_KIND_STRING_ENTRY(ARM_RELOC_BR24),
-    LLD_KIND_STRING_ENTRY(ARM_THUMB_RELOC_BR22),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_LO16),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_HI16),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_LO16),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_HI16),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_ABS32),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_POINTER32),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_TARGET),
-    LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_IMMEDIATE),
-    LLD_KIND_STRING_END
+  LLD_KIND_STRING_ENTRY(ARM_RELOC_BR24),
+  LLD_KIND_STRING_ENTRY(ARM_THUMB_RELOC_BR22),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_LO16),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_ABS_HI16),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_LO16),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_THUMB_REL_HI16),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_ABS32),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_POINTER32),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_TARGET),
+  LLD_KIND_STRING_ENTRY(LLD_ARM_RELOC_LAZY_IMMEDIATE),
+  LLD_KIND_STRING_END
 };
 
 bool KindHandler_arm::isCallSite(const Reference &ref) {
-  return (ref.kindValue() == ARM_THUMB_RELOC_BR22) || 
+  return (ref.kindValue() == ARM_THUMB_RELOC_BR22) ||
          (ref.kindValue() == ARM_RELOC_BR24);
 }
 
@@ -240,58 +235,55 @@
   return (ref.kindValue() == LLD_ARM_RELOC_POINTER32);
 }
 
-
 bool KindHandler_arm::isLazyImmediate(const Reference &ref) {
   return (ref.kindValue() == LLD_ARM_RELOC_LAZY_IMMEDIATE);
 }
 
-
 bool KindHandler_arm::isLazyTarget(const Reference &ref) {
   return (ref.kindValue() == LLD_ARM_RELOC_LAZY_TARGET);
 }
 
-
-void KindHandler_arm::applyFixup(Reference::KindNamespace ns, 
-                                 Reference::KindArch arch, 
-                                 Reference::KindValue kindValue, 
+void KindHandler_arm::applyFixup(Reference::KindNamespace ns,
+                                 Reference::KindArch arch,
+                                 Reference::KindValue kindValue,
                                  uint64_t addend, uint8_t *location,
-                                 uint64_t fixupAddress, 
+                                 uint64_t fixupAddress,
                                  uint64_t targetAddress) {
   if (ns != Reference::KindNamespace::mach_o)
     return;
   assert(arch == Reference::KindArch::ARM);
   //int32_t *loc32 = reinterpret_cast<int32_t*>(location);
-  switch ( kindValue ) {
-    case ARM_THUMB_RELOC_BR22:
+  switch (kindValue) {
+  case ARM_THUMB_RELOC_BR22:
       // FIXME
       break;
-    case ARM_RELOC_BR24:
+  case ARM_RELOC_BR24:
       // FIXME
       break;
-    case LLD_ARM_RELOC_THUMB_ABS_LO16:
+  case LLD_ARM_RELOC_THUMB_ABS_LO16:
       // FIXME
       break;
-    case LLD_ARM_RELOC_THUMB_ABS_HI16:
+  case LLD_ARM_RELOC_THUMB_ABS_HI16:
       // FIXME
       break;
-    case LLD_ARM_RELOC_THUMB_REL_LO16:
+  case LLD_ARM_RELOC_THUMB_REL_LO16:
       // FIXME
       break;
-    case LLD_ARM_RELOC_THUMB_REL_HI16:
+  case LLD_ARM_RELOC_THUMB_REL_HI16:
       // FIXME
       break;
-    case LLD_ARM_RELOC_ABS32:
+  case LLD_ARM_RELOC_ABS32:
       // FIXME
       break;
-    case LLD_ARM_RELOC_POINTER32:
+  case LLD_ARM_RELOC_POINTER32:
       // FIXME
       break;
-    case LLD_ARM_RELOC_LAZY_TARGET:
-    case LLD_ARM_RELOC_LAZY_IMMEDIATE:
+  case LLD_ARM_RELOC_LAZY_TARGET:
+  case LLD_ARM_RELOC_LAZY_IMMEDIATE:
       // do nothing
       break;
-    default:
-      llvm_unreachable("invalid ARM Reference Kind");
+  default:
+    llvm_unreachable("invalid ARM Reference Kind");
       break;
   }
 }
diff --git a/lld/lib/ReaderWriter/MachO/ReferenceKinds.h b/lld/lib/ReaderWriter/MachO/ReferenceKinds.h
index 159bbc6..ce1601e 100644
--- a/lld/lib/ReaderWriter/MachO/ReferenceKinds.h
+++ b/lld/lib/ReaderWriter/MachO/ReferenceKinds.h
@@ -23,29 +23,29 @@
 // Additional Reference Kind values used internally.
 enum {
   LLD_X86_64_RELOC_GOT_LOAD_NOW_LEA = 100,
-  LLD_X86_64_RELOC_TLV_NOW_LEA      = 101,
-  LLD_X86_64_RELOC_LAZY_TARGET      = 102,
-  LLD_X86_64_RELOC_LAZY_IMMEDIATE   = 103,
-  LLD_X86_64_RELOC_SIGNED_32        = 104,
+  LLD_X86_64_RELOC_TLV_NOW_LEA = 101,
+  LLD_X86_64_RELOC_LAZY_TARGET = 102,
+  LLD_X86_64_RELOC_LAZY_IMMEDIATE = 103,
+  LLD_X86_64_RELOC_SIGNED_32 = 104,
 };
 enum {
-  LLD_X86_RELOC_BRANCH32          = 100, // CALL or JMP 32-bit pc-rel
-  LLD_X86_RELOC_ABS32             = 101, // 32-bit absolute addr in instruction
-  LLD_X86_RELOC_FUNC_REL32        = 102, // 32-bit target from start of func
-  LLD_X86_RELOC_POINTER32         = 103, // 32-bit data pointer
-  LLD_X86_RELOC_LAZY_TARGET       = 104,
-  LLD_X86_RELOC_LAZY_IMMEDIATE    = 105
+  LLD_X86_RELOC_BRANCH32 = 100,   // CALL or JMP 32-bit pc-rel
+  LLD_X86_RELOC_ABS32 = 101,      // 32-bit absolute addr in instruction
+  LLD_X86_RELOC_FUNC_REL32 = 102, // 32-bit target from start of func
+  LLD_X86_RELOC_POINTER32 = 103,  // 32-bit data pointer
+  LLD_X86_RELOC_LAZY_TARGET = 104,
+  LLD_X86_RELOC_LAZY_IMMEDIATE = 105
 };
 enum {
-  LLD_ARM_RELOC_THUMB_ABS_LO16    = 100, // thumb movw of absolute address
-  LLD_ARM_RELOC_THUMB_ABS_HI16    = 101, // thumb movt of absolute address
-  LLD_ARM_RELOC_THUMB_REL_LO16    = 102, // thumb movw of (target - pc)
-  LLD_ARM_RELOC_THUMB_REL_HI16    = 103, // thumb movt of (target - pc)
-  LLD_ARM_RELOC_ABS32             = 104, // 32-bit constant pointer
-  LLD_ARM_RELOC_POINTER32         = 105, // 32-bit data pointer
-  LLD_ARM_RELOC_LAZY_TARGET       = 106,
-  LLD_ARM_RELOC_LAZY_IMMEDIATE    = 107,
-}; 
+  LLD_ARM_RELOC_THUMB_ABS_LO16 = 100, // thumb movw of absolute address
+  LLD_ARM_RELOC_THUMB_ABS_HI16 = 101, // thumb movt of absolute address
+  LLD_ARM_RELOC_THUMB_REL_LO16 = 102, // thumb movw of (target - pc)
+  LLD_ARM_RELOC_THUMB_REL_HI16 = 103, // thumb movt of (target - pc)
+  LLD_ARM_RELOC_ABS32 = 104,          // 32-bit constant pointer
+  LLD_ARM_RELOC_POINTER32 = 105,      // 32-bit data pointer
+  LLD_ARM_RELOC_LAZY_TARGET = 106,
+  LLD_ARM_RELOC_LAZY_IMMEDIATE = 107,
+};
 
 ///
 /// The KindHandler class is the abstract interface to Reference::Kind
@@ -58,16 +58,14 @@
   static std::unique_ptr<mach_o::KindHandler> create(MachOLinkingContext::Arch);
   virtual ~KindHandler();
 
-  virtual bool    isCallSite(const Reference&) = 0;
-  virtual bool    isPointer(const Reference&) = 0;
-  virtual bool    isLazyImmediate(const Reference&) = 0;
-  virtual bool    isLazyTarget(const Reference&) = 0;
-  virtual void    applyFixup(Reference::KindNamespace ns, 
-                            Reference::KindArch arch, 
-                            Reference::KindValue kindValue,
-                            uint64_t addend, uint8_t *location,
-                            uint64_t fixupAddress, 
-                            uint64_t targetAddress) = 0;
+  virtual bool isCallSite(const Reference &) = 0;
+  virtual bool isPointer(const Reference &) = 0;
+  virtual bool isLazyImmediate(const Reference &) = 0;
+  virtual bool isLazyTarget(const Reference &) = 0;
+  virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+                          Reference::KindValue kindValue, uint64_t addend,
+                          uint8_t *location, uint64_t fixupAddress,
+                          uint64_t targetAddress) = 0;
 
 protected:
   KindHandler();
@@ -77,56 +75,48 @@
 
 class KindHandler_x86_64 : public KindHandler {
 public:
-
   static const Registry::KindStrings kindStrings[];
-  
+
   virtual ~KindHandler_x86_64();
-  virtual bool isCallSite(const Reference&);
-  virtual bool isPointer(const Reference&);
-  virtual bool isLazyImmediate(const Reference&);
-  virtual bool isLazyTarget(const Reference&);
-  virtual void applyFixup(Reference::KindNamespace ns, 
-                          Reference::KindArch arch, 
-                          Reference::KindValue kindValue,
-                          uint64_t addend, uint8_t *location,
-                          uint64_t fixupAddress, uint64_t targetAddress);
+  virtual bool isCallSite(const Reference &);
+  virtual bool isPointer(const Reference &);
+  virtual bool isLazyImmediate(const Reference &);
+  virtual bool isLazyTarget(const Reference &);
+  virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+                          Reference::KindValue kindValue, uint64_t addend,
+                          uint8_t *location, uint64_t fixupAddress,
+                          uint64_t targetAddress);
 };
 
 
 class KindHandler_x86 : public KindHandler {
 public:
-
   static const Registry::KindStrings kindStrings[];
 
   virtual ~KindHandler_x86();
-  virtual bool isCallSite(const Reference&);
-  virtual bool isPointer(const Reference&);
-  virtual bool isLazyImmediate(const Reference&);
-  virtual bool isLazyTarget(const Reference&);
-  virtual void applyFixup(Reference::KindNamespace ns, 
-                          Reference::KindArch arch, 
-                          Reference::KindValue kindValue,
-                          uint64_t addend, uint8_t *location,
-                          uint64_t fixupAddress, uint64_t targetAddress);
-
+  virtual bool isCallSite(const Reference &);
+  virtual bool isPointer(const Reference &);
+  virtual bool isLazyImmediate(const Reference &);
+  virtual bool isLazyTarget(const Reference &);
+  virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+                          Reference::KindValue kindValue, uint64_t addend,
+                          uint8_t *location, uint64_t fixupAddress,
+                          uint64_t targetAddress);
 };
 
 class KindHandler_arm : public KindHandler {
 public:
-
   static const Registry::KindStrings kindStrings[];
 
   virtual ~KindHandler_arm();
-  virtual bool isCallSite(const Reference&);
-  virtual bool isPointer(const Reference&);
-  virtual bool isLazyImmediate(const Reference&);
-  virtual bool isLazyTarget(const Reference&);
-  virtual void applyFixup(Reference::KindNamespace ns, 
-                          Reference::KindArch arch, 
-                          Reference::KindValue kindValue,
-                          uint64_t addend, uint8_t *location,
-                          uint64_t fixupAddress, uint64_t targetAddress);
-
+  virtual bool isCallSite(const Reference &);
+  virtual bool isPointer(const Reference &);
+  virtual bool isLazyImmediate(const Reference &);
+  virtual bool isLazyTarget(const Reference &);
+  virtual void applyFixup(Reference::KindNamespace ns, Reference::KindArch arch,
+                          Reference::KindValue kindValue, uint64_t addend,
+                          uint8_t *location, uint64_t fixupAddress,
+                          uint64_t targetAddress);
 };
 
 
diff --git a/lld/lib/ReaderWriter/MachO/StubAtoms_x86.hpp b/lld/lib/ReaderWriter/MachO/StubAtoms_x86.hpp
index 480600a..31a2c2e 100644
--- a/lld/lib/ReaderWriter/MachO/StubAtoms_x86.hpp
+++ b/lld/lib/ReaderWriter/MachO/StubAtoms_x86.hpp
@@ -31,9 +31,9 @@
 public:
   X86StubAtom(const File &file, const Atom &lazyPointer)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_ABS32, 2, &lazyPointer, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_ABS32, 2,
+                       &lazyPointer, 0);
   }
 
   virtual ContentType contentType() const {
@@ -65,12 +65,12 @@
   X86StubHelperCommonAtom(const File &file, const Atom &cache,
                           const Atom &binder)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_ABS32, 1, &cache,  0);
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_ABS32, 7, &binder, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_ABS32, 1, &cache,
+                       0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_ABS32, 7,
+                       &binder, 0);
   }
 
   virtual ContentType contentType() const {
@@ -103,12 +103,12 @@
 public:
   X86StubHelperAtom(const File &file, const Atom &helperCommon)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_LAZY_IMMEDIATE, 1, this, 0);
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_BRANCH32, 6, &helperCommon, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_LAZY_IMMEDIATE,
+                       1, this, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_BRANCH32, 6,
+                       &helperCommon, 0);
   }
 
   virtual ContentType contentType() const {
@@ -140,12 +140,12 @@
 public:
   X86LazyPointerAtom(const File &file, const Atom &helper, const Atom &shlib)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_POINTER32,  0, &helper, 0);
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_LAZY_TARGET, 0, &shlib,  0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_POINTER32, 0,
+                       &helper, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_LAZY_TARGET, 0,
+                       &shlib, 0);
   }
 
   virtual ContentType contentType() const {
@@ -181,9 +181,9 @@
 
   X86NonLazyPointerAtom(const File &file, const Atom &shlib)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86, 
-                       LLD_X86_RELOC_POINTER32, 0, &shlib, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86, LLD_X86_RELOC_POINTER32, 0,
+                       &shlib, 0);
   }
 
   virtual ContentType contentType() const {
diff --git a/lld/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp b/lld/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp
index 6832736..cd857dd 100644
--- a/lld/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp
+++ b/lld/lib/ReaderWriter/MachO/StubAtoms_x86_64.hpp
@@ -32,9 +32,9 @@
 public:
   X86_64StubAtom(const File &file, const Atom &lazyPointer)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
-                       X86_64_RELOC_SIGNED, 2, &lazyPointer, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 2,
+                       &lazyPointer, 0);
   }
 
   virtual ContentType contentType() const {
@@ -65,12 +65,12 @@
   X86_64StubHelperCommonAtom(const File &file, const Atom &cache,
                              const Atom &binder)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
-                       X86_64_RELOC_SIGNED, 3,  &cache, 0);
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
-                       X86_64_RELOC_SIGNED, 11, &binder, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 3,
+                       &cache, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 11,
+                       &binder, 0);
   }
 
   virtual ContentType contentType() const {
@@ -103,12 +103,12 @@
 public:
   X86_64StubHelperAtom(const File &file, const Atom &helperCommon)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64,
                        LLD_X86_64_RELOC_LAZY_IMMEDIATE, 1, this, 0);
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
-                       X86_64_RELOC_SIGNED, 6, &helperCommon, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64, X86_64_RELOC_SIGNED, 6,
+                       &helperCommon, 0);
   }
 
   virtual ContentType contentType() const {
@@ -140,11 +140,11 @@
   X86_64LazyPointerAtom(const File &file, const Atom &helper,
                         const Atom &shlib)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
-                       X86_64_RELOC_UNSIGNED, 0, &helper, 0);
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64, X86_64_RELOC_UNSIGNED, 0,
+                       &helper, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64,
                        LLD_X86_64_RELOC_LAZY_TARGET, 0, &shlib, 0);
   }
 
@@ -181,9 +181,9 @@
 
   X86_64NonLazyPointerAtom(const File &file, const Atom &shlib)
       : SimpleDefinedAtom(file) {
-    this->addReference(Reference::KindNamespace::mach_o, 
-                       Reference::KindArch::x86_64, 
-                       X86_64_RELOC_UNSIGNED, 0, &shlib, 0);
+    this->addReference(Reference::KindNamespace::mach_o,
+                       Reference::KindArch::x86_64, X86_64_RELOC_UNSIGNED, 0,
+                       &shlib, 0);
   }
 
   virtual ContentType contentType() const {
diff --git a/lld/lib/ReaderWriter/MachO/StubsPass.hpp b/lld/lib/ReaderWriter/MachO/StubsPass.hpp
index ae9bf06..b392430 100644
--- a/lld/lib/ReaderWriter/MachO/StubsPass.hpp
+++ b/lld/lib/ReaderWriter/MachO/StubsPass.hpp
@@ -149,11 +149,10 @@
 
   class File : public SimpleFile {
   public:
-    File(const MachOLinkingContext &context)
-        : SimpleFile("MachO Stubs pass") {}
+    File(const MachOLinkingContext &context) : SimpleFile("MachO Stubs pass") {}
   };
 
-  const MachOLinkingContext                      &_context;
+  const MachOLinkingContext &_context;
   mach_o::KindHandler                            &_kindHandler;
   File                                            _file;
   llvm::DenseMap<const Atom*, const DefinedAtom*> _targetToStub;
diff --git a/lld/lib/ReaderWriter/Native/NativeFileFormat.h b/lld/lib/ReaderWriter/Native/NativeFileFormat.h
index 0f58e0a..f1e798a 100644
--- a/lld/lib/ReaderWriter/Native/NativeFileFormat.h
+++ b/lld/lib/ReaderWriter/Native/NativeFileFormat.h
@@ -202,10 +202,10 @@
   enum {
     noTarget = UINT16_MAX
   };
-  uint32_t  offsetInAtom;
-  uint16_t  kindValue;
-  uint8_t   kindNamespace;
-  uint8_t   kindArch;
+  uint32_t offsetInAtom;
+  uint16_t kindValue;
+  uint8_t kindNamespace;
+  uint8_t kindArch;
   uint16_t  targetIndex;
   uint16_t  addendIndex;
 };
@@ -220,9 +220,9 @@
   };
   uint64_t  offsetInAtom;
   int64_t   addend;
-  uint16_t  kindValue;
-  uint8_t   kindNamespace;
-  uint8_t   kindArch;
+  uint16_t kindValue;
+  uint8_t kindNamespace;
+  uint8_t kindArch;
   uint32_t  targetIndex;
 };
 
diff --git a/lld/lib/ReaderWriter/Native/ReaderNative.cpp b/lld/lib/ReaderWriter/Native/ReaderNative.cpp
index d7fc44f..afe0bfe 100644
--- a/lld/lib/ReaderWriter/Native/ReaderNative.cpp
+++ b/lld/lib/ReaderWriter/Native/ReaderNative.cpp
@@ -213,11 +213,10 @@
 //
 class NativeReferenceV1 : public Reference {
 public:
-  NativeReferenceV1(const File& f, const NativeReferenceIvarsV1* ivarData)
-      : Reference((KindNamespace)ivarData->kindNamespace, 
-                  (KindArch)ivarData->kindArch, ivarData->kindValue), 
-        _file(&f), _ivarData(ivarData) {
-  }
+  NativeReferenceV1(const File &f, const NativeReferenceIvarsV1 *ivarData)
+      : Reference((KindNamespace)ivarData->kindNamespace,
+                  (KindArch)ivarData->kindArch, ivarData->kindValue),
+        _file(&f), _ivarData(ivarData) {}
 
   virtual uint64_t offsetInAtom() const {
     return _ivarData->offsetInAtom;
@@ -240,11 +239,10 @@
 //
 class NativeReferenceV2 : public Reference {
 public:
-  NativeReferenceV2(const File& f, const NativeReferenceIvarsV2* ivarData)
-      : Reference((KindNamespace)ivarData->kindNamespace, 
-                  (KindArch)ivarData->kindArch, ivarData->kindValue), 
-        _file(&f), _ivarData(ivarData) {
-  }
+  NativeReferenceV2(const File &f, const NativeReferenceIvarsV2 *ivarData)
+      : Reference((KindNamespace)ivarData->kindNamespace,
+                  (KindArch)ivarData->kindArch, ivarData->kindValue),
+        _file(&f), _ivarData(ivarData) {}
 
   virtual uint64_t offsetInAtom() const {
     return _ivarData->offsetInAtom;
@@ -270,7 +268,7 @@
   /// Instantiates a File object from a native object file.  Ownership
   /// of the MemoryBuffer is transferred to the resulting File object.
   static error_code make(std::unique_ptr<MemoryBuffer> mb,
-                         std::vector<std::unique_ptr<lld::File> > &result) {
+                         std::vector<std::unique_ptr<lld::File>> &result) {
     const uint8_t *const base =
         reinterpret_cast<const uint8_t *>(mb->getBufferStart());
     StringRef path(mb->getBufferIdentifier());
@@ -842,8 +840,7 @@
     uint32_t           elementCount;
   };
 
-
-  std::unique_ptr<MemoryBuffer>   _buffer;
+  std::unique_ptr<MemoryBuffer> _buffer;
   const NativeFileHeader*         _header;
   AtomArray<DefinedAtom>          _definedAtoms;
   AtomArray<UndefinedAtom>        _undefinedAtoms;
@@ -860,9 +857,9 @@
   const char*                     _strings;
   uint32_t                        _stringsMaxOffset;
   const Reference::Addend*        _addends;
-  uint32_t                        _addendsMaxIndex;
-  const uint8_t                  *_contentStart;
-  const uint8_t                  *_contentEnd;
+  uint32_t _addendsMaxIndex;
+  const uint8_t *_contentStart;
+  const uint8_t *_contentEnd;
 };
 
 inline const lld::File &NativeDefinedAtomV1::file() const {
@@ -1001,19 +998,18 @@
 
 } // end namespace native
 
-
 namespace {
 
 class NativeReader : public Reader {
 public:
-  virtual bool canParse(file_magic magic, StringRef, 
-                                                const MemoryBuffer& mb) const {
+  virtual bool canParse(file_magic magic, StringRef,
+                        const MemoryBuffer &mb) const {
     const NativeFileHeader *const header =
-            reinterpret_cast<const NativeFileHeader *>(mb.getBufferStart());
-    return (memcmp(header->magic, NATIVE_FILE_HEADER_MAGIC, 
-                                                  sizeof(header->magic)) == 0);
+        reinterpret_cast<const NativeFileHeader *>(mb.getBufferStart());
+    return (memcmp(header->magic, NATIVE_FILE_HEADER_MAGIC,
+                   sizeof(header->magic)) == 0);
   }
-  
+
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
             std::vector<std::unique_ptr<File>> &result) const {
@@ -1021,12 +1017,10 @@
     return error_code::success();
   }
 };
-
-
 }
 
 void Registry::addSupportNativeObjects() {
-  add(std::unique_ptr<Reader>(new NativeReader())); 
+  add(std::unique_ptr<Reader>(new NativeReader()));
 }
 
 } // end namespace lld
diff --git a/lld/lib/ReaderWriter/PECOFF/Atoms.h b/lld/lib/ReaderWriter/PECOFF/Atoms.h
index 2057dd5..0748e95 100644
--- a/lld/lib/ReaderWriter/PECOFF/Atoms.h
+++ b/lld/lib/ReaderWriter/PECOFF/Atoms.h
@@ -28,11 +28,10 @@
 class COFFReference LLVM_FINAL : public Reference {
 public:
   COFFReference(const Atom *target, uint32_t offsetInAtom, uint16_t relocType,
-               Reference::KindNamespace ns=Reference::KindNamespace::COFF,
-               Reference::KindArch arch=Reference::KindArch::x86)
-      : Reference(ns, arch, relocType), 
-        _target(target), _offsetInAtom(offsetInAtom) {
-  }
+                Reference::KindNamespace ns = Reference::KindNamespace::COFF,
+                Reference::KindArch arch = Reference::KindArch::x86)
+      : Reference(ns, arch, relocType), _target(target),
+        _offsetInAtom(offsetInAtom) {}
 
   virtual const Atom *target() const { return _target; }
   virtual void setTarget(const Atom *newAtom) { _target = newAtom; }
@@ -343,7 +342,7 @@
 template <typename T, typename U>
 void addLayoutEdge(T *a, U *b, uint32_t which) {
   auto ref = new COFFReference(nullptr, 0, which, Reference::KindNamespace::all,
-                                                  Reference::KindArch::all);
+                               Reference::KindArch::all);
   ref->setTarget(b);
   a->addReference(std::unique_ptr<COFFReference>(ref));
 }
diff --git a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
index 251812e..a4fc743 100644
--- a/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
@@ -235,8 +235,7 @@
   uint32_t clearMask = (ci == _sectionClearMask.end()) ? 0 : ci->second;
   return (flags | setMask) & ~clearMask;
 }
- 
- 
+
 void PECOFFLinkingContext::addPasses(PassManager &pm) {
   pm.add(std::unique_ptr<Pass>(new pecoff::SetSubsystemPass(*this)));
   pm.add(std::unique_ptr<Pass>(new pecoff::EdataPass(*this)));
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
index bc5c7cc..e07a553 100644
--- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
@@ -58,8 +58,8 @@
   typedef vector<const coff_symbol *> SymbolVectorT;
   typedef std::map<const coff_section *, SymbolVectorT> SectionToSymbolsT;
   typedef std::map<const StringRef, Atom *> SymbolNameToAtomT;
-  typedef std::map<const coff_section *, vector<COFFDefinedFileAtom *> >
-      SectionToAtomsT;
+  typedef std::map<const coff_section *, vector<COFFDefinedFileAtom *>>
+  SectionToAtomsT;
 
 public:
   typedef const std::map<std::string, std::string> StringMap;
@@ -86,7 +86,6 @@
   StringRef getLinkerDirectives() const { return _directives; }
 
 private:
-
   error_code readSymbolTable(vector<const coff_symbol *> &result);
 
   void createAbsoluteAtoms(const SymbolVectorT &symbols,
@@ -102,10 +101,10 @@
   error_code cacheSectionAttributes();
 
   error_code
-      AtomizeDefinedSymbolsInSection(const coff_section *section,
-                                     StringMap &altNames,
-                                     vector<const coff_symbol *> &symbols,
-                                     vector<COFFDefinedFileAtom *> &atoms);
+  AtomizeDefinedSymbolsInSection(const coff_section *section,
+                                 StringMap &altNames,
+                                 vector<const coff_symbol *> &symbols,
+                                 vector<COFFDefinedFileAtom *> &atoms);
 
   error_code AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
                                    StringMap &altNames,
@@ -156,8 +155,8 @@
   // A sorted map to find an atom from a section and an offset within
   // the section.
   std::map<const coff_section *,
-           std::map<uint32_t, std::vector<COFFDefinedAtom *> > >
-      _definedAtomLocations;
+           std::map<uint32_t, std::vector<COFFDefinedAtom *>>>
+  _definedAtomLocations;
 
   mutable llvm::BumpPtrAllocator _alloc;
   uint64_t _ordinal;
@@ -530,16 +529,15 @@
                                          StringMap &altNames,
                                          vector<const coff_symbol *> &symbols,
                                          vector<COFFDefinedFileAtom *> &atoms) {
-    // Sort symbols by position.
+  // Sort symbols by position.
   std::stable_sort(
       symbols.begin(), symbols.end(),
       // For some reason MSVC fails to allow the lambda in this context with a
       // "illegal use of local type in type instantiation". MSVC is clearly
       // wrong here. Force a conversion to function pointer to work around.
-      static_cast<bool(*)(const coff_symbol *, const coff_symbol *)>(
-          [](const coff_symbol * a, const coff_symbol * b)->bool {
-    return a->Value < b->Value;
-  }));
+      static_cast<bool (*)(const coff_symbol *, const coff_symbol *)>([](
+          const coff_symbol * a,
+          const coff_symbol * b)->bool { return a->Value < b->Value; }));
 
   StringRef sectionName;
   if (error_code ec = _obj->getSectionName(section, sectionName))
@@ -808,7 +806,7 @@
 
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
-            std::vector<std::unique_ptr<File> > &result) const {
+            std::vector<std::unique_ptr<File>> &result) const {
     // Convert RC file to COFF
     ErrorOr<std::string> coffPath = convertResourceFileToCOFF(std::move(mb));
     if (!coffPath)
@@ -909,7 +907,7 @@
 
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry &registry,
-            std::vector<std::unique_ptr<File> > &result) const {
+            std::vector<std::unique_ptr<File>> &result) const {
     // Parse the memory buffer as PECOFF file.
     error_code ec;
     std::unique_ptr<FileCOFF> file(
@@ -982,7 +980,8 @@
   LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL),
   LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_TOKEN),
   LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECREL7),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL32), LLD_KIND_STRING_END
+  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL32),
+  LLD_KIND_STRING_END
 };
 
 const Registry::KindStrings kindStringsAMD64[] = {
@@ -1002,7 +1001,8 @@
   LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_TOKEN),
   LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SREL32),
   LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_PAIR),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SSPAN32), LLD_KIND_STRING_END
+  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SSPAN32),
+  LLD_KIND_STRING_END
 };
 
 } // end namespace anonymous
@@ -1020,5 +1020,4 @@
 void Registry::addSupportWindowsResourceFiles() {
   add(std::unique_ptr<Reader>(new ResourceFileReader()));
 }
-
 }
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
index a6ad676..10312c4 100644
--- a/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/ReaderImportHeader.cpp
@@ -181,7 +181,7 @@
 
     // The size of the string that follows the header.
     uint32_t dataSize = *reinterpret_cast<const support::ulittle32_t *>(
-        buf + offsetof(COFF::ImportHeader, SizeOfData));
+                             buf + offsetof(COFF::ImportHeader, SizeOfData));
 
     // Check if the total size is valid.
     if (end - buf != sizeof(COFF::ImportHeader) + dataSize) {
@@ -190,14 +190,14 @@
     }
 
     uint16_t hint = *reinterpret_cast<const support::ulittle16_t *>(
-        buf + offsetof(COFF::ImportHeader, OrdinalHint));
+                         buf + offsetof(COFF::ImportHeader, OrdinalHint));
     StringRef symbolName(buf + sizeof(COFF::ImportHeader));
     StringRef dllName(buf + sizeof(COFF::ImportHeader) + symbolName.size() + 1);
 
     // TypeInfo is a bitfield. The least significant 2 bits are import
     // type, followed by 3 bit import name type.
     uint16_t typeInfo = *reinterpret_cast<const support::ulittle16_t *>(
-        buf + offsetof(COFF::ImportHeader, TypeInfo));
+                             buf + offsetof(COFF::ImportHeader, TypeInfo));
     int type = typeInfo & 0x3;
     int nameType = (typeInfo >> 2) & 0x7;
 
@@ -301,7 +301,7 @@
 
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
-            std::vector<std::unique_ptr<File> > &result) const {
+            std::vector<std::unique_ptr<File>> &result) const {
     error_code ec;
     auto file = std::unique_ptr<File>(new FileImportLibrary(std::move(mb), ec));
     if (ec)
@@ -309,7 +309,6 @@
     result.push_back(std::move(file));
     return error_code::success();
   }
-
 };
 
 } // end anonymous namespace
diff --git a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
index a1b8189..d280be52 100644
--- a/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
@@ -106,7 +106,7 @@
       : HeaderChunk(), _context(ctx) {
     // Minimum size of DOS stub is 64 bytes. The next block (PE header) needs to
     // be aligned on 8 byte boundary.
-    size_t size = std::max(_context.getDosStub().size(), (size_t) 64);
+    size_t size = std::max(_context.getDosStub().size(), (size_t)64);
     _size = llvm::RoundUpToAlignment(size, 8);
   }
 
@@ -303,8 +303,8 @@
 
   // Create the content of a relocation block.
   std::vector<uint8_t>
-      createBaseRelocBlock(uint64_t pageAddr,
-                           const std::vector<uint16_t> &offsets) const;
+  createBaseRelocBlock(uint64_t pageAddr,
+                       const std::vector<uint16_t> &offsets) const;
 
   std::vector<uint8_t> _contents;
 };
@@ -752,7 +752,7 @@
   void setImageSizeOnDisk();
   void setAddressOfEntryPoint(AtomChunk *text, PEHeaderChunk *peHeader);
   uint64_t
-      calcSectionSize(llvm::COFF::SectionCharacteristics sectionType) const;
+  calcSectionSize(llvm::COFF::SectionCharacteristics sectionType) const;
 
   uint64_t calcSizeOfInitializedData() const {
     return calcSectionSize(llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA);
diff --git a/lld/lib/ReaderWriter/Reader.cpp b/lld/lib/ReaderWriter/Reader.cpp
index 69c5c34..8bfe109 100644
--- a/lld/lib/ReaderWriter/Reader.cpp
+++ b/lld/lib/ReaderWriter/Reader.cpp
@@ -25,9 +25,9 @@
   _readers.push_back(std::move(reader));
 }
 
-error_code 
+error_code
 Registry::parseFile(std::unique_ptr<MemoryBuffer> &mb,
-                          std::vector<std::unique_ptr<File>> &result) const {
+                    std::vector<std::unique_ptr<File>> &result) const {
   // Get file type.
   StringRef content(mb->getBufferStart(), mb->getBufferSize());
   llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(content);
@@ -39,36 +39,36 @@
     if (reader->canParse(fileType, extension, *mb))
       return reader->parseFile(mb, *this, result);
   }
-  
-  // No Reader could parse this file.     
+
+  // No Reader could parse this file.
   return llvm::make_error_code(llvm::errc::executable_format_error);
 }
 
 static const Registry::KindStrings kindStrings[] = {
-  { Reference::kindInGroup,       "in-group" },
-  { Reference::kindLayoutAfter,   "layout-after" },
-  { Reference::kindLayoutBefore,  "layout-before" },
+  { Reference::kindInGroup, "in-group" },
+  { Reference::kindLayoutAfter, "layout-after" },
+  { Reference::kindLayoutBefore, "layout-before" },
   LLD_KIND_STRING_END
 };
 
 Registry::Registry() {
-  addKindTable(Reference::KindNamespace::all, Reference::KindArch::all, 
-                                                                  kindStrings);
+  addKindTable(Reference::KindNamespace::all, Reference::KindArch::all,
+               kindStrings);
 }
 
-void Registry::addKindTable(Reference::KindNamespace ns, 
+void Registry::addKindTable(Reference::KindNamespace ns,
                             Reference::KindArch arch,
                             const KindStrings array[]) {
-  KindEntry entry = {ns, arch, array};
+  KindEntry entry = { ns, arch, array };
   _kindEntries.push_back(entry);
 }
 
-bool Registry::referenceKindFromString(StringRef inputStr, 
+bool Registry::referenceKindFromString(StringRef inputStr,
                                        Reference::KindNamespace &ns,
-                                       Reference::KindArch &arch, 
+                                       Reference::KindArch &arch,
                                        Reference::KindValue &value) const {
   for (const KindEntry &entry : _kindEntries) {
-    for (const KindStrings *pair=entry.array; !pair->name.empty(); ++pair) {
+    for (const KindStrings *pair = entry.array; !pair->name.empty(); ++pair) {
       if (!inputStr.equals(pair->name))
         continue;
       ns = entry.ns;
@@ -80,17 +80,16 @@
   return false;
 }
 
-
-bool Registry::referenceKindToString(Reference::KindNamespace ns, 
-                                     Reference::KindArch arch, 
-                                     Reference::KindValue value, 
+bool Registry::referenceKindToString(Reference::KindNamespace ns,
+                                     Reference::KindArch arch,
+                                     Reference::KindValue value,
                                      StringRef &str) const {
   for (const KindEntry &entry : _kindEntries) {
     if (entry.ns != ns)
       continue;
     if (entry.arch != arch)
       continue;
-    for (const KindStrings *pair=entry.array; !pair->name.empty(); ++pair) {
+    for (const KindStrings *pair = entry.array; !pair->name.empty(); ++pair) {
       if (pair->value != value)
         continue;
       str = pair->name;
@@ -100,5 +99,4 @@
   return false;
 }
 
-
 } // end namespace lld
diff --git a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
index e5356e7..1ec9a02 100644
--- a/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
+++ b/lld/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
@@ -253,8 +253,8 @@
 // For yaml, we just want one string that encapsulates the tuple.
 struct RefKind {
   Reference::KindNamespace ns;
-  Reference::KindArch      arch;
-  uint16_t                 value;
+  Reference::KindArch arch;
+  uint16_t value;
 };
 
 } // namespace anon
@@ -274,8 +274,8 @@
     YamlContext *info = reinterpret_cast<YamlContext *>(ctxt);
     assert(info->_registry);
     StringRef str;
-    if (info->_registry->referenceKindToString(kind.ns, kind.arch, kind.value, 
-                                                                           str)) 
+    if (info->_registry->referenceKindToString(kind.ns, kind.arch, kind.value,
+                                               str))
       out << str;
     else
       out << (int)(kind.ns) << "-" << (int)(kind.arch) << "-" << kind.value;
@@ -285,8 +285,8 @@
     assert(ctxt != nullptr);
     YamlContext *info = reinterpret_cast<YamlContext *>(ctxt);
     assert(info->_registry);
-    if (info->_registry->referenceKindFromString(scalar, kind.ns, kind.arch, 
-                                                                  kind.value)) 
+    if (info->_registry->referenceKindFromString(scalar, kind.ns, kind.arch,
+                                                 kind.value))
       return StringRef();
     return StringRef("unknown reference kind");
   }
@@ -564,8 +564,7 @@
 
   class NormArchiveFile : public lld::ArchiveLibraryFile {
   public:
-    NormArchiveFile(IO &io)
-        : ArchiveLibraryFile(""), _path() {}
+    NormArchiveFile(IO &io) : ArchiveLibraryFile(""), _path() {}
     NormArchiveFile(IO &io, const lld::File *file)
         : ArchiveLibraryFile(file->path()), _path(file->path()) {
       // If we want to support writing archives, this constructor would
@@ -606,11 +605,11 @@
       return nullptr;
     }
 
-    virtual error_code parseAllMembers(
-                          std::vector<std::unique_ptr<File>> &result) const {
+    virtual error_code
+    parseAllMembers(std::vector<std::unique_ptr<File>> &result) const {
       return error_code::success();
     }
-    
+
     StringRef _path;
     std::vector<ArchMember> _members;
   };
@@ -717,13 +716,13 @@
   class NormalizedReference : public lld::Reference {
   public:
     NormalizedReference(IO &io)
-        : lld::Reference(lld::Reference::KindNamespace::all, 
+        : lld::Reference(lld::Reference::KindNamespace::all,
                          lld::Reference::KindArch::all, 0),
-         _target(nullptr), _targetName(), _offset(0), _addend(0) {}
+          _target(nullptr), _targetName(), _offset(0), _addend(0) {}
 
     NormalizedReference(IO &io, const lld::Reference *ref)
-        : lld::Reference(ref->kindNamespace(), ref->kindArch(), 
-                                              ref->kindValue()),
+        : lld::Reference(ref->kindNamespace(), ref->kindArch(),
+                         ref->kindValue()),
           _target(nullptr), _targetName(targetName(io, ref)),
           _offset(ref->offsetInAtom()), _addend(ref->addend()) {
       _mappedKind.ns = ref->kindNamespace();
@@ -735,8 +734,7 @@
       YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
       assert(info != nullptr);
       typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
-      NormalizedFile *f =
-          reinterpret_cast<NormalizedFile *>(info->_file);
+      NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
       if (!_targetName.empty())
         _targetName = f->copyString(_targetName);
       DEBUG_WITH_TYPE("WriterYAML", llvm::dbgs()
@@ -809,8 +807,7 @@
       YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
       assert(info != nullptr);
       typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
-      NormalizedFile *f =
-          reinterpret_cast<NormalizedFile *>(info->_file);
+      NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
       if (!_name.empty())
         _name = f->copyString(_name);
       if (!_refName.empty())
@@ -905,8 +902,7 @@
       typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
       YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
       assert(info != nullptr);
-      NormalizedFile *f =
-          reinterpret_cast<NormalizedFile *>(info->_file);
+      NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
       assert(f);
       assert(f->_rnb);
       if (f->_rnb->hasRefName(atom)) {
@@ -959,8 +955,7 @@
       YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
       assert(info != nullptr);
       typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
-      NormalizedFile *f =
-          reinterpret_cast<NormalizedFile *>(info->_file);
+      NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
       if (!_name.empty())
         _name = f->copyString(_name);
 
@@ -1019,8 +1014,7 @@
       YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
       assert(info != nullptr);
       typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
-      NormalizedFile *f =
-          reinterpret_cast<NormalizedFile *>(info->_file);
+      NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
       if (!_name.empty())
         _name = f->copyString(_name);
       if (!_loadName.empty())
@@ -1083,8 +1077,7 @@
       YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
       assert(info != nullptr);
       typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
-      NormalizedFile *f =
-          reinterpret_cast<NormalizedFile *>(info->_file);
+      NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
       if (!_name.empty())
         _name = f->copyString(_name);
 
@@ -1122,8 +1115,7 @@
       typedef MappingTraits<const lld::File *>::NormalizedFile NormalizedFile;
       YamlContext *info = reinterpret_cast<YamlContext *>(io.getContext());
       assert(info != nullptr);
-      NormalizedFile *f =
-          reinterpret_cast<NormalizedFile *>(info->_file);
+      NormalizedFile *f = reinterpret_cast<NormalizedFile *>(info->_file);
       assert(f);
       assert(f->_rnb);
       if (f->_rnb->hasRefName(atom)) {
@@ -1249,12 +1241,12 @@
 
 class YAMLReader : public Reader {
 public:
-  YAMLReader(const Registry &registry) : _registry(registry) { }
+  YAMLReader(const Registry &registry) : _registry(registry) {}
 
-  virtual bool canParse(file_magic, StringRef ext, const MemoryBuffer&) const {
+  virtual bool canParse(file_magic, StringRef ext, const MemoryBuffer &) const {
     return (ext.equals(".objtxt") || ext.equals(".yaml"));
   }
-  
+
   virtual error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
             std::vector<std::unique_ptr<File>> &result) const {
@@ -1285,10 +1277,10 @@
     }
     return make_error_code(lld::YamlReaderError::success);
   }
+
 private:
   const Registry &_registry;
-};  
-
+};
 
 } // anonymous namespace
 
@@ -1296,7 +1288,6 @@
   add(std::unique_ptr<Reader>(new YAMLReader(*this)));
 }
 
-
 std::unique_ptr<Writer> createWriterYAML(const LinkingContext &context) {
   return std::unique_ptr<Writer>(new lld::yaml::Writer(context));
 }