summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-05 00:28:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-05 00:28:01 +0000
commitf94b3480fce38b376d02fb0775b9448bbda9313b (patch)
tree16b76d7c1b0f183069f60bf15857d671e0b95f23 /unittests
parentc88eb08d02f0aa17352e06c4e235bc1f225b2266 (diff)
downloadexternal_llvm-f94b3480fce38b376d02fb0775b9448bbda9313b.zip
external_llvm-f94b3480fce38b376d02fb0775b9448bbda9313b.tar.gz
external_llvm-f94b3480fce38b376d02fb0775b9448bbda9313b.tar.bz2
Simplify ErrorOr.
ErrorOr had quiet a bit of complexity and indirection to be able to hold a user type with the error. That feature is not used anymore. This patch removes it, it will live in svn history if we ever need it again. If we do need it again, IMHO there is one thing that should be done differently: Holding extra info in the error is not a property a function also returning a value or not. The ability to hold extra info should be in the error type and ErrorOr templated over it so that we don't need the funny looking ErrorOr<void>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/ErrorOrTest.cpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/unittests/Support/ErrorOrTest.cpp b/unittests/Support/ErrorOrTest.cpp
index 4853426..feb6a08 100644
--- a/unittests/Support/ErrorOrTest.cpp
+++ b/unittests/Support/ErrorOrTest.cpp
@@ -45,9 +45,6 @@ TEST(ErrorOr, Types) {
*a = 42;
EXPECT_EQ(42, x);
- EXPECT_FALSE(ErrorOr<void>(errc::broken_pipe));
- EXPECT_TRUE(ErrorOr<void>(errc::success));
-
#if LLVM_HAS_CXX11_STDLIB
// Move only types.
EXPECT_EQ(3, **t3());
@@ -67,38 +64,3 @@ TEST(ErrorOr, Covariant) {
#endif
}
} // end anon namespace
-
-struct InvalidArgError {
- InvalidArgError() {}
- InvalidArgError(std::string S) : ArgName(S) {}
- std::string ArgName;
-};
-
-namespace llvm {
-template<>
-struct ErrorOrUserDataTraits<InvalidArgError> : true_type {
- static error_code error() {
- return make_error_code(errc::invalid_argument);
- }
-};
-} // end namespace llvm
-
-ErrorOr<int> t4() {
- return InvalidArgError("adena");
-}
-
-ErrorOr<void> t5() {
- return InvalidArgError("pie");
-}
-
-namespace {
-TEST(ErrorOr, UserErrorData) {
- ErrorOr<int> a = t4();
- EXPECT_EQ(errc::invalid_argument, a);
- EXPECT_EQ("adena", t4().getError<InvalidArgError>().ArgName);
-
- ErrorOr<void> b = t5();
- EXPECT_EQ(errc::invalid_argument, b);
- EXPECT_EQ("pie", b.getError<InvalidArgError>().ArgName);
-}
-} // end anon namespace