[lld] r210015 - Run clang-format.

Rui Ueyama ruiu at google.com
Mon Jun 2 04:13:11 PDT 2014


Author: ruiu
Date: Mon Jun  2 06:13:11 2014
New Revision: 210015

URL: http://llvm.org/viewvc/llvm-project?rev=210015&view=rev
Log:
Run clang-format.

Modified:
    lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=210015&r1=210014&r2=210015&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Mon Jun  2 06:13:11 2014
@@ -116,17 +116,19 @@ private:
                                  std::vector<const coff_symbol *> &symbols,
                                  std::vector<COFFDefinedFileAtom *> &atoms);
 
-  error_code AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
-                                   std::vector<const DefinedAtom *> &definedAtoms);
+  error_code
+  AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
+                        std::vector<const DefinedAtom *> &definedAtoms);
 
   error_code findAtomAt(const coff_section *section, uint32_t targetAddress,
                         COFFDefinedFileAtom *&result, uint32_t &offsetInAtom);
 
   error_code getAtomBySymbolIndex(uint32_t index, Atom *&ret);
 
-  error_code addRelocationReference(const coff_relocation *rel,
-                                    const coff_section *section,
-                                    const std::vector<COFFDefinedFileAtom *> &atoms);
+  error_code
+  addRelocationReference(const coff_relocation *rel,
+                         const coff_section *section,
+                         const std::vector<COFFDefinedFileAtom *> &atoms);
 
   error_code getSectionContents(StringRef sectionName,
                                 ArrayRef<uint8_t> &result);
@@ -161,7 +163,8 @@ private:
   std::map<const coff_symbol *, const coff_symbol *> _auxSymbol;
 
   // A map from section to its atoms.
-  std::map<const coff_section *, std::vector<COFFDefinedFileAtom *> > _sectionAtoms;
+  std::map<const coff_section *, std::vector<COFFDefinedFileAtom *>>
+  _sectionAtoms;
 
   // A set of COMDAT sections.
   std::set<const coff_section *> _comdatSections;
@@ -360,8 +363,8 @@ error_code FileCOFF::readSymbolTable(std
         return ec;
       _auxSymbol[sym] = aux;
     }
- next:
-      i += sym->NumberOfAuxSymbols;
+  next:
+    i += sym->NumberOfAuxSymbols;
   }
   return error_code();
 }
@@ -441,8 +444,9 @@ FileCOFF::createUndefinedAtoms(const Sym
 /// Create atoms for the defined symbols. This pass is a bit complicated than
 /// the other two, because in order to create the atom for the defined symbol
 /// we need to know the adjacent symbols.
-error_code FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols,
-                                          std::vector<const DefinedAtom *> &result) {
+error_code
+FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols,
+                               std::vector<const DefinedAtom *> &result) {
   // A defined atom can be merged if its section attribute allows its contents
   // to be merged. In COFF, it's not very easy to get the section attribute
   // for the symbol, so scan all sections in advance and cache the attributes
@@ -571,19 +575,18 @@ error_code FileCOFF::cacheSectionAttribu
 
 /// Atomize \p symbols and append the results to \p atoms. The symbols are
 /// assumed to have been defined in the \p section.
-error_code
-FileCOFF::AtomizeDefinedSymbolsInSection(const coff_section *section,
-                                         std::vector<const coff_symbol *> &symbols,
-                                         std::vector<COFFDefinedFileAtom *> &atoms) {
+error_code FileCOFF::AtomizeDefinedSymbolsInSection(
+    const coff_section *section, std::vector<const coff_symbol *> &symbols,
+    std::vector<COFFDefinedFileAtom *> &atoms) {
   // 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))
@@ -671,9 +674,9 @@ FileCOFF::AtomizeDefinedSymbolsInSection
   return error_code();
 }
 
-error_code
-FileCOFF::AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols,
-                                std::vector<const DefinedAtom *> &definedAtoms) {
+error_code FileCOFF::AtomizeDefinedSymbols(
+    SectionToSymbolsT &definedSymbols,
+    std::vector<const DefinedAtom *> &definedAtoms) {
   // For each section, make atoms for all the symbols defined in the
   // section, and append the atoms to the result objects.
   for (auto &i : definedSymbols) {
@@ -728,10 +731,9 @@ error_code FileCOFF::getAtomBySymbolInde
 /// Add relocation information to an atom based on \p rel. \p rel is an
 /// relocation entry for the \p section, and \p atoms are all the atoms
 /// defined in the \p section.
-error_code
-FileCOFF::addRelocationReference(const coff_relocation *rel,
-                                 const coff_section *section,
-                                 const std::vector<COFFDefinedFileAtom *> &atoms) {
+error_code FileCOFF::addRelocationReference(
+    const coff_relocation *rel, const coff_section *section,
+    const std::vector<COFFDefinedFileAtom *> &atoms) {
   assert(atoms.size() > 0);
   // The address of the item which relocation is applied. Section's
   // VirtualAddress needs to be added for historical reasons, but the value
@@ -748,8 +750,7 @@ FileCOFF::addRelocationReference(const c
     return ec;
   atom->addReference(std::unique_ptr<COFFReference>(
       new COFFReference(targetAtom, offsetInAtom, rel->Type,
-                        Reference::KindNamespace::COFF,
-                        _referenceArch)));
+                        Reference::KindNamespace::COFF, _referenceArch)));
   return error_code();
 }
 
@@ -891,8 +892,8 @@ StringRef FileCOFF::ArrayRefToString(Arr
   size_t e = array.size();
   while (len < e && array[len] != '\0')
     ++len;
-  std::string *contents = new (_alloc)
-    std::string(reinterpret_cast<const char *>(&array[0]), len);
+  std::string *contents =
+      new (_alloc) std::string(reinterpret_cast<const char *>(&array[0]), len);
   return StringRef(*contents).trim();
 }
 
@@ -912,7 +913,7 @@ public:
 
   error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const class Registry &,
-            std::vector<std::unique_ptr<File> > &result) const override {
+            std::vector<std::unique_ptr<File>> &result) const override {
     // Convert RC file to COFF
     ErrorOr<std::string> coffPath = convertResourceFileToCOFF(std::move(mb));
     if (error_code ec = coffPath.getError())
@@ -1012,7 +1013,7 @@ public:
 
   error_code
   parseFile(std::unique_ptr<MemoryBuffer> &mb, const Registry &registry,
-            std::vector<std::unique_ptr<File> > &result) const override {
+            std::vector<std::unique_ptr<File>> &result) const override {
     // Parse the memory buffer as PECOFF file.
     const char *mbName = mb->getBufferIdentifier();
     error_code ec;
@@ -1119,40 +1120,38 @@ private:
 using namespace llvm::COFF;
 
 const Registry::KindStrings kindStringsI386[] = {
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_ABSOLUTE),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR16),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL16),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32NB),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SEG12),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECTION),
-  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_ABSOLUTE),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR16),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_REL16),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_DIR32NB),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SEG12),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_I386_SECTION),
+    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};
 
 const Registry::KindStrings kindStringsAMD64[] = {
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ABSOLUTE),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR64),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32NB),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_1),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_2),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_3),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_4),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_5),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECTION),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL),
-  LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL7),
-  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_ABSOLUTE),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR64),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_ADDR32NB),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_1),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_2),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_3),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_4),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_REL32_5),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECTION),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL),
+    LLD_KIND_STRING_ENTRY(IMAGE_REL_AMD64_SECREL7),
+    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};
 
 } // end namespace anonymous
 





More information about the llvm-commits mailing list