llvm.org GIT mirror llvm / a11b564
llvm-modextract: Call keep() on the output stream before exiting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288435 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 3 years ago
2 changed file(s) with 7 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
22 ; RUN: not llvm-modextract -n 1 -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
33 ; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck %s
44 ; RUN: not llvm-modextract -b -n 1 -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
5
6 ; RUN: llvm-modextract -n 0 -o %t0 %t
7 ; RUN: llvm-dis -o - %t0 | FileCheck %s
8 ; RUN: llvm-modextract -b -n 0 -o %t1 %t
9 ; RUN: llvm-dis -o - %t1 | FileCheck %s
510
611 ; CHECK: define void @f()
712 ; ERROR: llvm-modextract: error: module index out of range; bitcode file contains 1 module(s)
6161 SmallVector Header;
6262 BitcodeWriter Writer(Header);
6363 Out->os() << Header << Ms[ModuleIndex].getBuffer();
64 Out->keep();
6465 return 0;
6566 }
6667
6768 std::unique_ptr M = ExitOnErr(Ms[ModuleIndex].parseModule(Context));
6869 WriteBitcodeToFile(M.get(), Out->os());
6970
71 Out->keep();
7072 return 0;
7173 }