#include <iostream> is forbidden. Remove it in favor of raw_ostream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74507 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2009-06-30 04:07:12 +00:00
parent f3c21b857b
commit 9cdd4f57c8
3 changed files with 24 additions and 27 deletions

View File

@ -13,10 +13,8 @@
#include "llvm/CompilerDriver/Action.h" #include "llvm/CompilerDriver/Action.h"
#include "llvm/CompilerDriver/BuiltinOptions.h" #include "llvm/CompilerDriver/BuiltinOptions.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Program.h" #include "llvm/System/Program.h"
#include <iostream>
#include <stdexcept> #include <stdexcept>
using namespace llvm; using namespace llvm;
@ -58,15 +56,15 @@ namespace {
} }
void print_string (const std::string& str) { void print_string (const std::string& str) {
std::cerr << str << ' '; errs() << str << ' ';
} }
} }
int llvmc::Action::Execute() const { int llvmc::Action::Execute() const {
if (DryRun || VerboseMode) { if (DryRun || VerboseMode) {
std::cerr << Command_ << " "; errs() << Command_ << " ";
std::for_each(Args_.begin(), Args_.end(), print_string); std::for_each(Args_.begin(), Args_.end(), print_string);
std::cerr << '\n'; errs() << '\n';
} }
if (DryRun) if (DryRun)
return 0; return 0;

View File

@ -18,10 +18,10 @@
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include "llvm/Support/DOTGraphTraits.h" #include "llvm/Support/DOTGraphTraits.h"
#include "llvm/Support/GraphWriter.h" #include "llvm/Support/GraphWriter.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <iostream>
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include <queue> #include <queue>
@ -346,7 +346,7 @@ int CompilationGraph::CheckLanguageNames() const {
if (!N2.ToolPtr) { if (!N2.ToolPtr) {
++ret; ++ret;
std::cerr << "Error: there is an edge from '" << N1.ToolPtr->Name() errs() << "Error: there is an edge from '" << N1.ToolPtr->Name()
<< "' back to the root!\n\n"; << "' back to the root!\n\n";
continue; continue;
} }
@ -363,17 +363,17 @@ int CompilationGraph::CheckLanguageNames() const {
if (!eq) { if (!eq) {
++ret; ++ret;
std::cerr << "Error: Output->input language mismatch in the edge '" << errs() << "Error: Output->input language mismatch in the edge '"
N1.ToolPtr->Name() << "' -> '" << N2.ToolPtr->Name() << "'!\n"; << N1.ToolPtr->Name() << "' -> '" << N2.ToolPtr->Name()
<< "'!\n"
std::cerr << "Expected one of { "; << "Expected one of { ";
InLangs = N2.ToolPtr->InputLanguages(); InLangs = N2.ToolPtr->InputLanguages();
for (;*InLangs; ++InLangs) { for (;*InLangs; ++InLangs) {
std::cerr << '\'' << *InLangs << (*(InLangs+1) ? "', " : "'"); errs() << '\'' << *InLangs << (*(InLangs+1) ? "', " : "'");
} }
std::cerr << " }, but got '" << OutLang << "'!\n\n"; errs() << " }, but got '" << OutLang << "'!\n\n";
} }
} }
@ -406,8 +406,7 @@ int CompilationGraph::CheckMultipleDefaultEdges() const {
} }
else if (EdgeWeight == MaxWeight) { else if (EdgeWeight == MaxWeight) {
++ret; ++ret;
std::cerr errs() << "Error: there are multiple maximal edges stemming from the '"
<< "Error: there are multiple maximal edges stemming from the '"
<< N.ToolPtr->Name() << "' node!\n\n"; << N.ToolPtr->Name() << "' node!\n\n";
break; break;
} }
@ -440,9 +439,9 @@ int CompilationGraph::CheckCycles() {
} }
if (deleted != NodesMap.size()) { if (deleted != NodesMap.size()) {
std::cerr << "Error: there are cycles in the compilation graph!\n" errs() << "Error: there are cycles in the compilation graph!\n"
<< "Try inspecting the diagram produced by " << "Try inspecting the diagram produced by "
"'llvmc --view-graph'.\n\n"; << "'llvmc --view-graph'.\n\n";
return 1; return 1;
} }
@ -518,9 +517,9 @@ void CompilationGraph::writeGraph(const std::string& OutputFilename) {
std::ofstream O(OutputFilename.c_str()); std::ofstream O(OutputFilename.c_str());
if (O.good()) { if (O.good()) {
std::cerr << "Writing '"<< OutputFilename << "' file..."; errs() << "Writing '"<< OutputFilename << "' file...";
llvm::WriteGraph(O, this); llvm::WriteGraph(O, this);
std::cerr << "done.\n"; errs() << "done.\n";
O.close(); O.close();
} }
else { else {

View File

@ -16,9 +16,9 @@
#include "llvm/CompilerDriver/Error.h" #include "llvm/CompilerDriver/Error.h"
#include "llvm/CompilerDriver/Plugin.h" #include "llvm/CompilerDriver/Plugin.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h" #include "llvm/System/Path.h"
#include <iostream>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
@ -91,7 +91,7 @@ int Main(int argc, char** argv) {
if (CheckGraph) { if (CheckGraph) {
int ret = graph.Check(); int ret = graph.Check();
if (!ret) if (!ret)
std::cerr << "check-graph: no errors found.\n"; llvm::errs() << "check-graph: no errors found.\n";
return ret; return ret;
} }
@ -119,10 +119,10 @@ int Main(int argc, char** argv) {
return ec.code(); return ec.code();
} }
catch(const std::exception& ex) { catch(const std::exception& ex) {
std::cerr << argv[0] << ": " << ex.what() << '\n'; llvm::errs() << argv[0] << ": " << ex.what() << '\n';
} }
catch(...) { catch(...) {
std::cerr << argv[0] << ": unknown error!\n"; llvm::errs() << argv[0] << ": unknown error!\n";
} }
return 1; return 1;
} }