[llvm-readobj] - Remove 'error(Error EC)' helper.

We do not need it. I replaced it with
reportError(StringRef Input, Error Err).

Differential revision: https://reviews.llvm.org/D66011

llvm-svn: 368677
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 78216ef..e650ba4 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -4417,7 +4417,7 @@
       for (const auto &Note : Obj->notes(P, Err))
         ProcessNote(Note);
       if (Err)
-        error(std::move(Err));
+        reportError(std::move(Err), this->FileName);
     }
   } else {
     for (const auto &S :
@@ -4429,7 +4429,7 @@
       for (const auto &Note : Obj->notes(S, Err))
         ProcessNote(Note);
       if (Err)
-        error(std::move(Err));
+        reportError(std::move(Err), this->FileName);
     }
   }
 }
@@ -4483,10 +4483,10 @@
   // integer.
   if (*Offset == PrevOffset)
     reportError(
-        FileStr,
         createStringError(object_error::parse_failed,
                           "could not extract a valid stack size in section %s",
-                          SectionName.data()));
+                          SectionName.data()),
+        FileStr);
 
   printStackSizeEntry(StackSize, FuncName);
 }
@@ -4545,11 +4545,12 @@
 
   uint64_t Offset = Reloc.getOffset();
   if (!Data.isValidOffsetForDataOfSize(Offset, sizeof(Elf_Addr) + 1))
-    reportError(FileStr, createStringError(
-                             object_error::parse_failed,
-                             "found invalid relocation offset into section %s "
-                             "while trying to extract a stack size entry",
-                             StackSizeSectionName.data()));
+    reportError(
+        createStringError(object_error::parse_failed,
+                          "found invalid relocation offset into section %s "
+                          "while trying to extract a stack size entry",
+                          StackSizeSectionName.data()),
+        FileStr);
 
   uint64_t Addend = Data.getAddress(&Offset);
   uint64_t SymValue = Resolver(Reloc, RelocSymValue, Addend);
@@ -4595,11 +4596,11 @@
       // size. Check for an extra byte before we try to process the entry.
       if (!Data.isValidOffsetForDataOfSize(Offset, sizeof(Elf_Addr) + 1)) {
         reportError(
-            FileStr,
             createStringError(
                 object_error::parse_failed,
                 "section %s ended while trying to extract a stack size entry",
-                SectionName.data()));
+                SectionName.data()),
+            FileStr);
       }
       uint64_t SymValue = Data.getAddress(&Offset);
       printFunctionStackSize(Obj, SymValue,
@@ -4689,10 +4690,10 @@
         RelocSec.getName(RelocSectionName);
         StringRef RelocName = EF->getRelocationTypeName(Reloc.getType());
         reportError(
-            FileStr,
             createStringError(object_error::parse_failed,
                               "unsupported relocation type in section %s: %s",
-                              RelocSectionName.data(), RelocName.data()));
+                              RelocSectionName.data(), RelocName.data()),
+            FileStr);
       }
       this->printStackSize(Obj, Reloc, FunctionSec, StackSizeSectionName,
                            Resolver, Data);
@@ -5568,7 +5569,7 @@
       for (const auto &Note : Obj->notes(P, Err))
         ProcessNote(Note);
       if (Err)
-        error(std::move(Err));
+        reportError(std::move(Err), this->FileName);
     }
   } else {
     for (const auto &S : unwrapOrError(this->FileName, Obj->sections())) {
@@ -5580,7 +5581,7 @@
       for (const auto &Note : Obj->notes(S, Err))
         ProcessNote(Note);
       if (Err)
-        error(std::move(Err));
+        reportError(std::move(Err), this->FileName);
     }
   }
 }