[llvm] r288435 - llvm-modextract: Call keep() on the output stream before exiting.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 1 15:13:11 PST 2016
Author: pcc
Date: Thu Dec 1 17:13:11 2016
New Revision: 288435
URL: http://llvm.org/viewvc/llvm-project?rev=288435&view=rev
Log:
llvm-modextract: Call keep() on the output stream before exiting.
Modified:
llvm/trunk/test/tools/llvm-modextract/single.ll
llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp
Modified: llvm/trunk/test/tools/llvm-modextract/single.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-modextract/single.ll?rev=288435&r1=288434&r2=288435&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-modextract/single.ll (original)
+++ llvm/trunk/test/tools/llvm-modextract/single.ll Thu Dec 1 17:13:11 2016
@@ -4,6 +4,11 @@
; RUN: llvm-modextract -b -n 0 -o - %t | llvm-dis | FileCheck %s
; RUN: not llvm-modextract -b -n 1 -o - %t 2>&1 | FileCheck --check-prefix=ERROR %s
+; RUN: llvm-modextract -n 0 -o %t0 %t
+; RUN: llvm-dis -o - %t0 | FileCheck %s
+; RUN: llvm-modextract -b -n 0 -o %t1 %t
+; RUN: llvm-dis -o - %t1 | FileCheck %s
+
; CHECK: define void @f()
; ERROR: llvm-modextract: error: module index out of range; bitcode file contains 1 module(s)
Modified: llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp?rev=288435&r1=288434&r2=288435&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp (original)
+++ llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp Thu Dec 1 17:13:11 2016
@@ -62,11 +62,13 @@ int main(int argc, char **argv) {
SmallVector<char, 0> Header;
BitcodeWriter Writer(Header);
Out->os() << Header << Ms[ModuleIndex].getBuffer();
+ Out->keep();
return 0;
}
std::unique_ptr<Module> M = ExitOnErr(Ms[ModuleIndex].parseModule(Context));
WriteBitcodeToFile(M.get(), Out->os());
+ Out->keep();
return 0;
}
More information about the llvm-commits
mailing list