From: Chris Lattner Date: Tue, 24 Sep 2002 00:09:48 +0000 (+0000) Subject: Make sure to close the file before deleting it X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=93c26685bf80f38c4b23d0ed9b0735d6dbb9c1d3;p=oota-llvm.git Make sure to close the file before deleting it git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3905 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/dis/dis.cpp b/tools/dis/dis.cpp index 8d1749c3d14..166a178d574 100644 --- a/tools/dis/dis.cpp +++ b/tools/dis/dis.cpp @@ -115,7 +115,10 @@ int main(int argc, char **argv) { Passes.run(*M.get()); - if (Out != &std::cout) delete Out; + if (Out != &std::cout) { + ((std::ofstream*)Out)->close(); + delete Out; + } return 0; } diff --git a/tools/llvm-dis/dis.cpp b/tools/llvm-dis/dis.cpp index 8d1749c3d14..166a178d574 100644 --- a/tools/llvm-dis/dis.cpp +++ b/tools/llvm-dis/dis.cpp @@ -115,7 +115,10 @@ int main(int argc, char **argv) { Passes.run(*M.get()); - if (Out != &std::cout) delete Out; + if (Out != &std::cout) { + ((std::ofstream*)Out)->close(); + delete Out; + } return 0; } diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 8d1749c3d14..166a178d574 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -115,7 +115,10 @@ int main(int argc, char **argv) { Passes.run(*M.get()); - if (Out != &std::cout) delete Out; + if (Out != &std::cout) { + ((std::ofstream*)Out)->close(); + delete Out; + } return 0; }