[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

llvm-svn: 320856
This commit is contained in:
Jake Ehrlich 2017-12-15 20:17:55 +00:00
parent 29832a6c8b
commit 777fb00a76
2 changed files with 22 additions and 26 deletions
llvm/tools/llvm-objcopy

View File

@ -227,8 +227,7 @@ template <class SymTabType>
void RelocSectionWithSymtabBase<SymTabType>::removeSectionReferences(
const SectionBase *Sec) {
if (Symbols == Sec) {
error("Symbol table " + Symbols->Name +
" cannot be removed because it is "
error("Symbol table " + Symbols->Name + " cannot be removed because it is "
"referenced by the relocation "
"section " +
this->Name);
@ -245,9 +244,9 @@ void RelocSectionWithSymtabBase<SymTabType>::initialize(
" 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,8 +293,7 @@ void DynamicRelocationSection::writeSection(FileOutputBuffer &Out) const {
void SectionWithStrTab::removeSectionReferences(const SectionBase *Sec) {
if (StrTab == Sec) {
error("String table " + StrTab->Name +
" cannot be removed because it is "
error("String table " + StrTab->Name + " cannot be removed because it is "
"referenced by the section " +
this->Name);
}
@ -306,8 +304,8 @@ bool SectionWithStrTab::classof(const SectionBase *S) {
}
void SectionWithStrTab::initialize(SectionTableRef SecTable) {
auto StrTab =
SecTable.getSection(Link, "Link field value " + Twine(Link) +
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 +
@ -416,8 +414,8 @@ void Object<ELFT>::initSymbolTable(const object::ELFFile<ELFT> &ElfFile,
}
} else if (Sym.st_shndx != SHN_UNDEF) {
DefSection = SecTable.getSection(
Sym.st_shndx, "Symbol '" + Name +
"' is defined in invalid section with index " +
Sym.st_shndx,
"Symbol '" + Name + "' is defined in invalid section with index " +
Twine(Sym.st_shndx));
}

View File

@ -100,7 +100,8 @@ static cl::opt<bool> StripDebug("strip-debug",
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",
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"));
@ -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<ELFT> &ObjFile, StringRef File) {
// 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")
@ -207,7 +205,7 @@ void CopyBinary(const ELFObjectFile<ELFT> &ObjFile) {
return false;
if (&Sec == Obj->getSectionHeaderStrTab())
return false;
switch(Sec.Type) {
switch (Sec.Type) {
case SHT_SYMTAB:
case SHT_REL:
case SHT_RELA: