mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 03:24:09 +00:00
Finishing touch for the std::error_code transition.
While std::error_code itself seems to work OK in all platforms, there are few annoying differences with regards to the std::errc enumeration. This patch adds a simple llvm enumeration, which will hopefully avoid build breakages in other platforms and surprises as we get more uses of std::error_code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <memory>
|
||||
|
||||
@ -16,7 +17,7 @@ using namespace llvm;
|
||||
namespace {
|
||||
|
||||
ErrorOr<int> t1() {return 1;}
|
||||
ErrorOr<int> t2() { return std::errc::invalid_argument; }
|
||||
ErrorOr<int> t2() { return errc::invalid_argument; }
|
||||
|
||||
TEST(ErrorOr, SimpleValue) {
|
||||
ErrorOr<int> a = t1();
|
||||
@ -30,7 +31,7 @@ TEST(ErrorOr, SimpleValue) {
|
||||
|
||||
a = t2();
|
||||
EXPECT_FALSE(a);
|
||||
EXPECT_EQ(std::errc::invalid_argument, a.getError());
|
||||
EXPECT_EQ(a.getError(), errc::invalid_argument);
|
||||
#ifdef EXPECT_DEBUG_DEATH
|
||||
EXPECT_DEBUG_DEATH(*a, "Cannot get value when an error exists");
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user