From 3025e48a88d56cd156cbc81b2ac18adff513182c Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 29 Aug 2017 23:29:09 +0000 Subject: [Error] Add an optional error message to cantFail. cantFail is the moral equivalent of an assertion that the wrapped call must return a success value. This patch allows clients to include an associated error message (the same way they would for an assertion for llvm_unreachable). If the error message is not specified it will default to: "Failure value returned from cantFail wrapped call". llvm-svn: 312066 --- llvm/unittests/Support/ErrorTest.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'llvm/unittests/Support/ErrorTest.cpp') diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp index db332eb..6010122 100644 --- a/llvm/unittests/Support/ErrorTest.cpp +++ b/llvm/unittests/Support/ErrorTest.cpp @@ -486,8 +486,9 @@ TEST(Error, CantFailSuccess) { #if LLVM_ENABLE_ABI_BREAKING_CHECKS && !defined(NDEBUG) TEST(Error, CantFailDeath) { EXPECT_DEATH( - cantFail(make_error("foo", inconvertibleErrorCode())), - "Failure value returned from cantFail wrapped call") + cantFail(make_error("foo", inconvertibleErrorCode()), + "Cantfail call failed"), + "Cantfail call failed") << "cantFail(Error) did not cause an abort for failure value"; EXPECT_DEATH( -- cgit v1.1