[lld] r221128 - [LinkerScript] Change ErrorOr usage to fix MSVC2012 buildbots

Rafael Auler rafaelauler at gmail.com
Sun Nov 2 21:26:18 PST 2014


Author: rafauler
Date: Sun Nov  2 23:26:18 2014
New Revision: 221128

URL: http://llvm.org/viewvc/llvm-project?rev=221128&view=rev
Log:
[LinkerScript] Change ErrorOr usage to fix MSVC2012 buildbots

Number parsing functions used an ErrorOr<> idiom that is not supported in
MSVC2012. This patch fixes this.

Modified:
    lld/trunk/lib/ReaderWriter/LinkerScript.cpp

Modified: lld/trunk/lib/ReaderWriter/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/LinkerScript.cpp?rev=221128&r1=221127&r2=221128&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/LinkerScript.cpp (original)
+++ lld/trunk/lib/ReaderWriter/LinkerScript.cpp Sun Nov  2 23:26:18 2014
@@ -94,7 +94,7 @@ static llvm::ErrorOr<uint64_t> parseDeci
   for (auto &c : str) {
     res *= 10;
     if (c < '0' || c > '9')
-      return std::errc::io_error;
+      return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
     res += c - '0';
   }
   return res;
@@ -105,7 +105,7 @@ static llvm::ErrorOr<uint64_t> parseOcta
   for (auto &c : str) {
     res <<= 3;
     if (c < '0' || c > '7')
-      return std::errc::io_error;
+      return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
     res += c - '0';
   }
   return res;
@@ -116,7 +116,7 @@ static llvm::ErrorOr<uint64_t> parseBina
   for (auto &c : str) {
     res <<= 1;
     if (c != '0' && c != '1')
-      return std::errc::io_error;
+      return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
     res += c - '0';
   }
   return res;
@@ -133,7 +133,7 @@ static llvm::ErrorOr<uint64_t> parseHex(
     else if (c >= 'A' && c <= 'F')
       res += c - 'A' + 10;
     else
-      return std::errc::io_error;
+      return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
   }
   return res;
 }





More information about the llvm-commits mailing list