[llvm] r320856 - [llvm-objcopy] Reformat everything using clang-format -i

Jake Ehrlich via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 12:17:55 PST 2017


Author: jakehehrlich
Date: Fri Dec 15 12:17:55 2017
New Revision: 320856

URL: http://llvm.org/viewvc/llvm-project?rev=320856&view=rev
Log:
[llvm-objcopy] Reformat everything using clang-format -i

Overtime some non-clang formatted code has creeped into llvm-objcopy. This
patch fixes all of that.

Differential Revision: https://reviews.llvm.org/D41262

Modified:
    llvm/trunk/tools/llvm-objcopy/Object.cpp
    llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp

Modified: llvm/trunk/tools/llvm-objcopy/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/Object.cpp?rev=320856&r1=320855&r2=320856&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/Object.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/Object.cpp Fri Dec 15 12:17:55 2017
@@ -227,10 +227,9 @@ template <class SymTabType>
 void RelocSectionWithSymtabBase<SymTabType>::removeSectionReferences(
     const SectionBase *Sec) {
   if (Symbols == Sec) {
-    error("Symbol table " + Symbols->Name +
-          " cannot be removed because it is "
-          "referenced by the relocation "
-          "section " +
+    error("Symbol table " + Symbols->Name + " cannot be removed because it is "
+                                            "referenced by the relocation "
+                                            "section " +
           this->Name);
   }
 }
@@ -245,9 +244,9 @@ void RelocSectionWithSymtabBase<SymTabTy
           " is not a symbol table"));
 
   if (Info != SHN_UNDEF)
-    setSection(SecTable.getSection(Info, "Info field value " + Twine(Info) +
-                                             " in section " + Name +
-                                             " is invalid"));
+    setSection(SecTable.getSection(Info,
+                                   "Info field value " + Twine(Info) +
+                                       " in section " + Name + " is invalid"));
   else
     setSection(nullptr);
 }
@@ -294,9 +293,8 @@ void DynamicRelocationSection::writeSect
 
 void SectionWithStrTab::removeSectionReferences(const SectionBase *Sec) {
   if (StrTab == Sec) {
-    error("String table " + StrTab->Name +
-          " cannot be removed because it is "
-          "referenced by the section " +
+    error("String table " + StrTab->Name + " cannot be removed because it is "
+                                           "referenced by the section " +
           this->Name);
   }
 }
@@ -306,9 +304,9 @@ bool SectionWithStrTab::classof(const Se
 }
 
 void SectionWithStrTab::initialize(SectionTableRef SecTable) {
-  auto StrTab =
-      SecTable.getSection(Link, "Link field value " + Twine(Link) +
-                                    " in section " + Name + " is invalid");
+  auto StrTab = SecTable.getSection(Link,
+                                    "Link field value " + Twine(Link) +
+                                        " in section " + Name + " is invalid");
   if (StrTab->Type != SHT_STRTAB) {
     error("Link field value " + Twine(Link) + " in section " + Name +
           " is not a string table");
@@ -416,9 +414,9 @@ void Object<ELFT>::initSymbolTable(const
       }
     } else if (Sym.st_shndx != SHN_UNDEF) {
       DefSection = SecTable.getSection(
-          Sym.st_shndx, "Symbol '" + Name +
-                            "' is defined in invalid section with index " +
-                            Twine(Sym.st_shndx));
+          Sym.st_shndx,
+          "Symbol '" + Name + "' is defined in invalid section with index " +
+              Twine(Sym.st_shndx));
     }
 
     SymTab->addSymbol(Name, Sym.getBinding(), Sym.getType(), DefSection,

Modified: llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp?rev=320856&r1=320855&r2=320856&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/llvm-objcopy.cpp Fri Dec 15 12:17:55 2017
@@ -73,7 +73,7 @@ LLVM_ATTRIBUTE_NORETURN void reportError
 
 static cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input>"));
 static cl::opt<std::string> OutputFilename(cl::Positional, cl::desc("<output>"),
-                                    cl::init("-"));
+                                           cl::init("-"));
 static cl::opt<std::string>
     OutputFormat("O", cl::desc("Set output format to one of the following:"
                                "\n\tbinary"));
@@ -100,8 +100,9 @@ static cl::opt<bool> StripDebug("strip-d
                                 cl::desc("Removes all debug information"));
 static cl::opt<bool> StripSections("strip-sections",
                                    cl::desc("Remove all section headers"));
-static cl::opt<bool> StripNonAlloc("strip-non-alloc",
-                                   cl::desc("Remove all non-allocated sections"));
+static cl::opt<bool>
+    StripNonAlloc("strip-non-alloc",
+                  cl::desc("Remove all non-allocated sections"));
 static cl::opt<bool>
     StripDWO("strip-dwo", cl::desc("Remove all DWARF .dwo sections from file"));
 static cl::opt<bool> ExtractDWO(
@@ -115,9 +116,7 @@ static cl::opt<std::string>
 
 using SectionPred = std::function<bool(const SectionBase &Sec)>;
 
-bool IsDWOSection(const SectionBase &Sec) {
-  return Sec.Name.endswith(".dwo");
-}
+bool IsDWOSection(const SectionBase &Sec) { return Sec.Name.endswith(".dwo"); }
 
 template <class ELFT>
 bool OnlyKeepDWOPred(const Object<ELFT> &Obj, const SectionBase &Sec) {
@@ -164,8 +163,7 @@ void SplitDWOToFile(const ELFObjectFile<
 // any previous removals. Lastly whether or not something is removed shouldn't
 // depend a) on the order the options occur in or b) on some opaque priority
 // system. The only priority is that keeps/copies overrule removes.
-template <class ELFT>
-void CopyBinary(const ELFObjectFile<ELFT> &ObjFile) {
+template <class ELFT> void CopyBinary(const ELFObjectFile<ELFT> &ObjFile) {
   std::unique_ptr<Object<ELFT>> Obj;
 
   if (!OutputFormat.empty() && OutputFormat != "binary")
@@ -176,7 +174,7 @@ void CopyBinary(const ELFObjectFile<ELFT
     Obj = llvm::make_unique<ELFObject<ELFT>>(ObjFile);
 
   if (!SplitDWO.empty())
-    SplitDWOToFile<ELFT>(ObjFile, SplitDWO.getValue());
+    SplitDWOToFile<ELFT>(ObjFile, SplitDWO.getValue()); 
 
   SectionPred RemovePred = [](const SectionBase &) { return false; };
 
@@ -207,7 +205,7 @@ void CopyBinary(const ELFObjectFile<ELFT
         return false;
       if (&Sec == Obj->getSectionHeaderStrTab())
         return false;
-      switch(Sec.Type) {
+      switch (Sec.Type) {
       case SHT_SYMTAB:
       case SHT_REL:
       case SHT_RELA:




More information about the llvm-commits mailing list