diff options
Diffstat (limited to 'utils/TableGen/TableGen.cpp')
-rw-r--r-- | utils/TableGen/TableGen.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index 1adc448b5b..4345234c27 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -17,6 +17,7 @@ #include "Record.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" #include "llvm/Support/FileUtilities.h" #include "CodeEmitterGen.h" @@ -99,12 +100,12 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv); ParseFile(InputFilename, IncludeDirs); - std::ostream *Out = &std::cout; + std::ostream *Out = cout.stream(); if (OutputFilename != "-") { Out = new std::ofstream(OutputFilename.c_str()); if (!Out->good()) { - std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } @@ -164,22 +165,22 @@ int main(int argc, char **argv) { return 1; } } catch (const std::string &Error) { - std::cerr << argv[0] << ": " << Error << "\n"; - if (Out != &std::cout) { + cerr << argv[0] << ": " << Error << "\n"; + if (Out != cout.stream()) { delete Out; // Close the file std::remove(OutputFilename.c_str()); // Remove the file, it's broken } return 1; } catch (...) { - std::cerr << argv[0] << ": Unknown unexpected exception occurred.\n"; - if (Out != &std::cout) { + cerr << argv[0] << ": Unknown unexpected exception occurred.\n"; + if (Out != cout.stream()) { delete Out; // Close the file std::remove(OutputFilename.c_str()); // Remove the file, it's broken } return 2; } - if (Out != &std::cout) { + if (Out != cout.stream()) { delete Out; // Close the file } return 0; |