What should be the last unnecessary <iostream>s in the library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32333 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp
index 1adc448..4345234 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 @@
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 @@
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;