From: Rui Ueyama Date: Mon, 2 Jun 2014 11:13:11 +0000 (+0000) Subject: Run clang-format. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02162b9cfadf1ced15cd124b6d3798db4f378752;p=platform%2Fupstream%2Fllvm.git Run clang-format. llvm-svn: 210015 --- diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index c78e599..c562c63 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -116,17 +116,19 @@ private: std::vector &symbols, std::vector &atoms); - error_code AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols, - std::vector &definedAtoms); + error_code + AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols, + std::vector &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 &atoms); + error_code + addRelocationReference(const coff_relocation *rel, + const coff_section *section, + const std::vector &atoms); error_code getSectionContents(StringRef sectionName, ArrayRef &result); @@ -161,7 +163,8 @@ private: std::map _auxSymbol; // A map from section to its atoms. - std::map > _sectionAtoms; + std::map> + _sectionAtoms; // A set of COMDAT sections. std::set _comdatSections; @@ -360,8 +363,8 @@ error_code FileCOFF::readSymbolTable(std::vector &result) { return ec; _auxSymbol[sym] = aux; } - next: - i += sym->NumberOfAuxSymbols; + next: + i += sym->NumberOfAuxSymbols; } return error_code(); } @@ -441,8 +444,9 @@ FileCOFF::createUndefinedAtoms(const SymbolVectorT &symbols, /// 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 &result) { +error_code +FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols, + std::vector &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::cacheSectionAttributes() { /// 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 &symbols, - std::vector &atoms) { +error_code FileCOFF::AtomizeDefinedSymbolsInSection( + const coff_section *section, std::vector &symbols, + std::vector &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([]( - const coff_symbol * a, - const coff_symbol * b)->bool { return a->Value < b->Value; })); + static_cast( + [](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(const coff_section *section, return error_code(); } -error_code -FileCOFF::AtomizeDefinedSymbols(SectionToSymbolsT &definedSymbols, - std::vector &definedAtoms) { +error_code FileCOFF::AtomizeDefinedSymbols( + SectionToSymbolsT &definedSymbols, + std::vector &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::getAtomBySymbolIndex(uint32_t index, Atom *&ret) { /// 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 &atoms) { +error_code FileCOFF::addRelocationReference( + const coff_relocation *rel, const coff_section *section, + const std::vector &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 coff_relocation *rel, return ec; atom->addReference(std::unique_ptr( new COFFReference(targetAtom, offsetInAtom, rel->Type, - Reference::KindNamespace::COFF, - _referenceArch))); + Reference::KindNamespace::COFF, _referenceArch))); return error_code(); } @@ -891,8 +892,8 @@ StringRef FileCOFF::ArrayRefToString(ArrayRef array) { size_t e = array.size(); while (len < e && array[len] != '\0') ++len; - std::string *contents = new (_alloc) - std::string(reinterpret_cast(&array[0]), len); + std::string *contents = + new (_alloc) std::string(reinterpret_cast(&array[0]), len); return StringRef(*contents).trim(); } @@ -912,7 +913,7 @@ public: error_code parseFile(std::unique_ptr &mb, const class Registry &, - std::vector > &result) const override { + std::vector> &result) const override { // Convert RC file to COFF ErrorOr coffPath = convertResourceFileToCOFF(std::move(mb)); if (error_code ec = coffPath.getError()) @@ -1012,7 +1013,7 @@ public: error_code parseFile(std::unique_ptr &mb, const Registry ®istry, - std::vector > &result) const override { + std::vector> &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