Remove object_error::success and use std::error_code() instead

make_error_code(object_error) is slow because object::object_category()
uses a ManagedStatic variable. But the real problem is that the function is
called too frequently. This patch uses std::error_code() instead of
object_error::success. In most cases, we return "success", so this patch
reduces number of function calls to that function.

http://reviews.llvm.org/D10333



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239409 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama
2015-06-09 15:20:42 +00:00
parent c154887856
commit eae4673c2f
19 changed files with 125 additions and 126 deletions

View File

@ -400,7 +400,7 @@ static std::error_code getRelocationValueString(const ELFObjectFile<ELFT> *Obj,
}
if (Result.empty())
Result.append(res.begin(), res.end());
return object_error::success;
return std::error_code();
}
static std::error_code getRelocationValueString(const ELFObjectFileBase *Obj,
@ -425,7 +425,7 @@ static std::error_code getRelocationValueString(const COFFObjectFile *Obj,
if (std::error_code EC = SymI->getName(SymName))
return EC;
Result.append(SymName.begin(), SymName.end());
return object_error::success;
return std::error_code();
}
static void printRelocationTargetName(const MachOObjectFile *O,
@ -569,7 +569,7 @@ static std::error_code getRelocationValueString(const MachOObjectFile *Obj,
// Generic relocation types...
switch (Type) {
case MachO::GENERIC_RELOC_PAIR: // prints no info
return object_error::success;
return std::error_code();
case MachO::GENERIC_RELOC_SECTDIFF: {
DataRefImpl RelNext = Rel;
Obj->moveRelocationNext(RelNext);
@ -667,7 +667,7 @@ static std::error_code getRelocationValueString(const MachOObjectFile *Obj,
fmt.flush();
Result.append(fmtbuf.begin(), fmtbuf.end());
return object_error::success;
return std::error_code();
}
static std::error_code getRelocationValueString(const RelocationRef &Rel,