Fix opt -o option. Don't pass a pointer to an auto variable which is going
authorNick Lewycky <nicholas@mxc.ca>
Fri, 1 Dec 2006 00:43:14 +0000 (00:43 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Fri, 1 Dec 2006 00:43:14 +0000 (00:43 +0000)
away before it's needed, and don't try to delete that pointer!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32055 91177308-0d34-0410-b5e6-96231b3b80d8

tools/opt/opt.cpp

index e43b76ff95ff147c4279f93e2bce111031e11284..c552d694fb39752505633a9ed5e57562f8bd13f2 100644 (file)
@@ -252,10 +252,9 @@ int main(int argc, char **argv) {
       Passes.add(createVerifierPass());
 
     // Write bytecode out to disk or cout as the last step...
-    if (!NoOutput && !AnalyzeOnly) {
-      llvm_ostream L(*Out);
-      Passes.add(new WriteBytecodePass(&L, Out != &std::cout, !NoCompress));
-    }
+    llvm_ostream L(*Out);
+    if (!NoOutput && !AnalyzeOnly)
+      Passes.add(new WriteBytecodePass(&L, false, !NoCompress));
 
     // Now that we have all of the passes ready, run them.
     Passes.run(*M.get());