aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/ErrorTest.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2024-07-31 16:38:14 +0000
committerDavid Blaikie <dblaikie@gmail.com>2024-07-31 16:40:26 +0000
commit45ef0d492f7b61613d0833fbf7eafdd41e137139 (patch)
tree2f69edccd161312f1cf56f2fc642fb5bbb5e8b9a /llvm/unittests/Support/ErrorTest.cpp
parent3715035797a8b07ddaf2e2eff08fedc535891e15 (diff)
downloadllvm-45ef0d492f7b61613d0833fbf7eafdd41e137139.zip
llvm-45ef0d492f7b61613d0833fbf7eafdd41e137139.tar.gz
llvm-45ef0d492f7b61613d0833fbf7eafdd41e137139.tar.bz2
Add llvm::Error C API, LLVMCantFail
It's barely testable - the test does exercise the code, but wouldn't fail on an empty implementation. It would cause a memory leak though (because the error handle wouldn't be unwrapped/reowned) which could be detected by asan and other leak detectors.
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
-rw-r--r--llvm/unittests/Support/ErrorTest.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index bd098a4..4cd9896 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -930,6 +930,8 @@ TEST(Error, C_API) {
});
EXPECT_TRUE(GotCSE) << "Failed to round-trip ErrorList via C API";
EXPECT_TRUE(GotCE) << "Failed to round-trip ErrorList via C API";
+
+ LLVMCantFail(wrap(Error::success()));
}
TEST(Error, FileErrorTest) {