diff options
| author | Lang Hames <lhames@gmail.com> | 2016-03-23 23:57:28 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2016-03-23 23:57:28 +0000 |
| commit | e7aad357a95be22a91d4d7d4131fb5fcf49f50ca (patch) | |
| tree | 96389cfb0103da5454cd2d5d47077fe0b47f6735 /llvm/unittests/Support/ErrorTest.cpp | |
| parent | ea00b499c703bbdbf4c87573cf2fe5b46a0bf1c2 (diff) | |
| download | llvm-e7aad357a95be22a91d4d7d4131fb5fcf49f50ca.zip llvm-e7aad357a95be22a91d4d7d4131fb5fcf49f50ca.tar.gz llvm-e7aad357a95be22a91d4d7d4131fb5fcf49f50ca.tar.bz2 | |
[Support] Make all Errors convertible to std::error_code.
This is a temporary crutch to enable code that currently uses std::error_code
to be incrementally moved over to Error. Requiring all Error instances be
convertible enables clients to call errorToErrorCode on any error (not just
ECErrors created by conversion *from* an error_code).
This patch also moves code for Error from ErrorHandling.cpp into a new
Error.cpp file.
llvm-svn: 264221
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
| -rw-r--r-- | llvm/unittests/Support/ErrorTest.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp index 788dcd3..1807547 100644 --- a/llvm/unittests/Support/ErrorTest.cpp +++ b/llvm/unittests/Support/ErrorTest.cpp @@ -9,6 +9,7 @@ #include "llvm/Support/Error.h" #include "llvm/Support/Errc.h" +#include "llvm/Support/ErrorHandling.h" #include "gtest/gtest.h" #include <memory> @@ -30,6 +31,10 @@ public: OS << "CustomError { " << getInfo() << "}"; } + std::error_code convertToErrorCode() const override { + llvm_unreachable("CustomError doesn't support ECError conversion"); + } + protected: // This error is subclassed below, but we can't use inheriting constructors // yet, so we can't propagate the constructors through ErrorInfo. Instead @@ -57,6 +62,10 @@ public: OS << "CustomSubError { " << getInfo() << ", " << getExtraInfo() << "}"; } + std::error_code convertToErrorCode() const override { + llvm_unreachable("CustomSubError doesn't support ECError conversion"); + } + protected: int ExtraInfo; }; |
