summaryrefslogtreecommitdiff
path: root/tools/llc
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-27 19:47:36 +0000
committerDan Gohman <gohman@apple.com>2010-05-27 19:47:36 +0000
commit26a707493903729aab49e02a082a0e481003b760 (patch)
tree1648663d429b77cdf81c1da6ca60aa8a235df196 /tools/llc
parent57bd6431134d2fe7c8e9f8362b18e283d017b947 (diff)
Avoid calling outs() and fouts() when the stream isn't really needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104873 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llc')
-rw-r--r--tools/llc/llc.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index f3eed56accd..199a1a92043 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -124,7 +124,8 @@ static formatted_raw_ostream *GetOutputStream(const char *TargetName,
const char *ProgName) {
if (OutputFilename != "") {
if (OutputFilename == "-")
- return &fouts();
+ return new formatted_raw_ostream(outs(),
+ formatted_raw_ostream::PRESERVE_STREAM);
// Make sure that the Out file gets unlinked from the disk if we get a
// SIGINT
@@ -147,7 +148,8 @@ static formatted_raw_ostream *GetOutputStream(const char *TargetName,
if (InputFilename == "-") {
OutputFilename = "-";
- return &fouts();
+ return new formatted_raw_ostream(outs(),
+ formatted_raw_ostream::PRESERVE_STREAM);
}
OutputFilename = GetFileNameRoot(InputFilename);
@@ -332,7 +334,7 @@ int main(int argc, char **argv) {
DisableVerify)) {
errs() << argv[0] << ": target does not support generation of this"
<< " file type!\n";
- if (Out != &fouts()) delete Out;
+ delete Out;
// And the Out file is empty and useless, so remove it now.
sys::Path(OutputFilename).eraseFromDisk();
return 1;
@@ -340,8 +342,8 @@ int main(int argc, char **argv) {
PM.run(mod);
- // Delete the ostream if it's not a stdout stream
- if (Out != &fouts()) delete Out;
+ // Delete the ostream.
+ delete Out;
return 0;
}