summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-13 17:23:15 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-13 17:23:15 +0000
commita0b4c565fddb8249488414fb8583c1f60578009b (patch)
tree12126f5e1d5f684a77a26a85566a19dabfc99dba
parent408b45249a708608d57a8ec377d7e70a84cd0080 (diff)
downloadbcm5719-llvm-a0b4c565fddb8249488414fb8583c1f60578009b.tar.gz
bcm5719-llvm-a0b4c565fddb8249488414fb8583c1f60578009b.zip
Don't use std::errc.
As noted on Errc.h: // * std::errc is just marked with is_error_condition_enum. This means that // common patters like AnErrorCode == errc::no_such_file_or_directory take // 4 virtual calls instead of two comparisons. And on some libstdc++ those virtual functions conclude that ------------------------ int main() { std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory); return foo == std::errc::no_such_file_or_directory; } ------------------------- should exit with 0. llvm-svn: 239685
-rw-r--r--lld/lib/ReaderWriter/LinkerScript.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lld/lib/ReaderWriter/LinkerScript.cpp b/lld/lib/ReaderWriter/LinkerScript.cpp
index 9c7f9374feb..6d82e29d95a 100644
--- a/lld/lib/ReaderWriter/LinkerScript.cpp
+++ b/lld/lib/ReaderWriter/LinkerScript.cpp
@@ -16,6 +16,7 @@
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Errc.h"
#include "llvm/Support/ELF.h"
namespace lld {
@@ -106,7 +107,7 @@ static llvm::ErrorOr<uint64_t> parseDecimal(StringRef str) {
for (auto &c : str) {
res *= 10;
if (c < '0' || c > '9')
- return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
+ return llvm::ErrorOr<uint64_t>(make_error_code(llvm::errc::io_error));
res += c - '0';
}
return res;
@@ -117,7 +118,7 @@ static llvm::ErrorOr<uint64_t> parseOctal(StringRef str) {
for (auto &c : str) {
res <<= 3;
if (c < '0' || c > '7')
- return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
+ return llvm::ErrorOr<uint64_t>(make_error_code(llvm::errc::io_error));
res += c - '0';
}
return res;
@@ -128,7 +129,7 @@ static llvm::ErrorOr<uint64_t> parseBinary(StringRef str) {
for (auto &c : str) {
res <<= 1;
if (c != '0' && c != '1')
- return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
+ return llvm::ErrorOr<uint64_t>(make_error_code(llvm::errc::io_error));
res += c - '0';
}
return res;
@@ -145,7 +146,7 @@ static llvm::ErrorOr<uint64_t> parseHex(StringRef str) {
else if (c >= 'A' && c <= 'F')
res += c - 'A' + 10;
else
- return llvm::ErrorOr<uint64_t>(std::make_error_code(std::errc::io_error));
+ return llvm::ErrorOr<uint64_t>(make_error_code(llvm::errc::io_error));
}
return res;
}
@@ -1637,7 +1638,7 @@ llvm::ErrorOr<InputSectionsCmd::VectorTy> Parser::parseExcludeFile() {
if (!expectAndConsume(Token::l_paren, "expected ("))
return llvm::ErrorOr<InputSectionsCmd::VectorTy>(
- std::make_error_code(std::errc::io_error));
+ make_error_code(llvm::errc::io_error));
while (_tok._kind == Token::identifier) {
res.push_back(new (_alloc) InputSectionName(*this, _tok._range, true));
@@ -1646,7 +1647,7 @@ llvm::ErrorOr<InputSectionsCmd::VectorTy> Parser::parseExcludeFile() {
if (!expectAndConsume(Token::r_paren, "expected )"))
return llvm::ErrorOr<InputSectionsCmd::VectorTy>(
- std::make_error_code(std::errc::io_error));
+ make_error_code(llvm::errc::io_error));
return llvm::ErrorOr<InputSectionsCmd::VectorTy>(std::move(res));
}
OpenPOWER on IntegriCloud