aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-c-test
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2022-07-04 13:35:26 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2022-07-08 20:06:44 +0200
commit5a731d733c569a6518ca136d6e907fae19942f4b (patch)
tree855c0f136316d895671e8667085e7e59ae13c082 /llvm/tools/llvm-c-test
parentbc2a6defc853553b3896cb853bb84fe663f6bfd0 (diff)
downloadllvm-5a731d733c569a6518ca136d6e907fae19942f4b.zip
llvm-5a731d733c569a6518ca136d6e907fae19942f4b.tar.gz
llvm-5a731d733c569a6518ca136d6e907fae19942f4b.tar.bz2
Fix test: LLVMGetBitcodeModule takes ownership of memory buffer
Clarify this behavior in the C interface header file and fix a related bug in a test. Differential Revision: https://reviews.llvm.org/D129113
Diffstat (limited to 'llvm/tools/llvm-c-test')
-rw-r--r--llvm/tools/llvm-c-test/diagnostic.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/tools/llvm-c-test/diagnostic.c b/llvm/tools/llvm-c-test/diagnostic.c
index d759097..0f9b48b 100644
--- a/llvm/tools/llvm-c-test/diagnostic.c
+++ b/llvm/tools/llvm-c-test/diagnostic.c
@@ -70,13 +70,8 @@ int llvm_test_diagnostic_handler(void) {
LLVMModuleRef M;
int Ret = LLVMGetBitcodeModule2(MB, &M);
- if (Ret) {
- // We do not return if the bitcode was invalid, as we want to test whether
- // the diagnostic handler was executed.
- fprintf(stderr, "Error parsing bitcode: %s\n", msg);
- }
-
- LLVMDisposeMemoryBuffer(MB);
+ if (Ret)
+ LLVMDisposeMemoryBuffer(MB);
if (handlerCalled) {
fprintf(stderr, "Diagnostic handler was called while loading module\n");