[lld] r245282 - COFF: Use ErrorOr::operator* instead of ErrorOr::get.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 02:18:16 PDT 2015


Author: ruiu
Date: Tue Aug 18 04:18:15 2015
New Revision: 245282

URL: http://llvm.org/viewvc/llvm-project?rev=245282&view=rev
Log:
COFF: Use ErrorOr::operator* instead of ErrorOr::get.

This patch is to make COFF coding style consistent with ELF. NFC.

Modified:
    lld/trunk/COFF/DriverUtils.cpp
    lld/trunk/COFF/InputFiles.cpp

Modified: lld/trunk/COFF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=245282&r1=245281&r2=245282&view=diff
==============================================================================
--- lld/trunk/COFF/DriverUtils.cpp (original)
+++ lld/trunk/COFF/DriverUtils.cpp Tue Aug 18 04:18:15 2015
@@ -53,7 +53,7 @@ public:
   void run() {
     ErrorOr<std::string> ExeOrErr = llvm::sys::findProgramByName(Prog);
     error(ExeOrErr, Twine("unable to find ") + Prog + " in PATH: ");
-    const char *Exe = Saver.save(ExeOrErr.get());
+    const char *Exe = Saver.save(*ExeOrErr);
     Args.insert(Args.begin(), Exe);
     Args.push_back(nullptr);
     if (llvm::sys::ExecuteAndWait(Args[0], Args.data()) != 0) {

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=245282&r1=245281&r2=245282&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Tue Aug 18 04:18:15 2015
@@ -54,7 +54,7 @@ void ArchiveFile::parse() {
   // Parse a MemoryBufferRef as an archive file.
   auto ArchiveOrErr = Archive::create(MB);
   error(ArchiveOrErr, "Failed to parse static library");
-  File = std::move(ArchiveOrErr.get());
+  File = std::move(*ArchiveOrErr);
 
   // Allocate a buffer for Lazy objects.
   size_t NumSyms = File->getNumberOfSymbols();
@@ -79,7 +79,7 @@ MemoryBufferRef ArchiveFile::getMember(c
   auto ItOrErr = Sym->getMember();
   error(ItOrErr,
         Twine("Could not get the member for symbol ") + Sym->getName());
-  Archive::child_iterator It = ItOrErr.get();
+  Archive::child_iterator It = *ItOrErr;
 
   // Return an empty buffer if we have already returned the same buffer.
   if (Seen[It->getChildOffset()].test_and_set())
@@ -94,7 +94,7 @@ void ObjectFile::parse() {
   // Parse a memory buffer as a COFF file.
   auto BinOrErr = createBinary(MB);
   error(BinOrErr, "Failed to parse object file");
-  std::unique_ptr<Binary> Bin = std::move(BinOrErr.get());
+  std::unique_ptr<Binary> Bin = std::move(*BinOrErr);
 
   if (auto *Obj = dyn_cast<COFFObjectFile>(Bin.get())) {
     Bin.release();
@@ -156,7 +156,7 @@ void ObjectFile::initializeSymbols() {
     auto SymOrErr = COFFObj->getSymbol(I);
     error(SymOrErr, Twine("broken object file: ") + getName());
 
-    COFFSymbolRef Sym = SymOrErr.get();
+    COFFSymbolRef Sym = *SymOrErr;
 
     const void *AuxP = nullptr;
     if (Sym.getNumberOfAuxSymbols())




More information about the llvm-commits mailing list