Change uses of std::cerr/std::cout to llvm::Lcerr/llvm::cout, and remove

#include<iostream>.

Patch provided by Sam Bishop.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45962 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ted Kremenek 2008-01-14 16:44:48 +00:00
Родитель aa58f00ebb
Коммит bdd30c26bd
4 изменённых файлов: 58 добавлений и 59 удалений

Просмотреть файл

@ -14,7 +14,6 @@
#include "clang/AST/StmtGraphTraits.h"
#include "llvm/Support/GraphWriter.h"
#include <iostream>
#include <sstream>
using namespace clang;
@ -23,7 +22,7 @@ void Stmt::viewAST() const {
#ifndef NDEBUG
llvm::ViewGraph(this,"AST");
#else
std::cerr << "Stmt::viewAST is only available in debug builds on "
llvm::cerr << "Stmt::viewAST is only available in debug builds on "
<< "systems with Graphviz or gv!\n";
#endif
}

Просмотреть файл

@ -15,7 +15,7 @@
#include "clang.h"
#include "clang/Parse/Action.h"
#include "clang/Parse/DeclSpec.h"
#include <iostream>
#include "llvm/Support/Streams.h"
using namespace clang;
namespace {
@ -29,13 +29,13 @@ namespace {
/// "int X = 4" or "typedef int foo".
virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,
DeclTy *LastInGroup) {
std::cout << "ActOnDeclarator ";
llvm::cout << "ActOnDeclarator ";
if (IdentifierInfo *II = D.getIdentifier()) {
std::cout << "'" << II->getName() << "'";
llvm::cout << "'" << II->getName() << "'";
} else {
std::cout << "<anon>";
llvm::cout << "<anon>";
}
std::cout << "\n";
llvm::cout << "\n";
// Pass up to EmptyActions so that the symbol table is maintained right.
return MinimalAction::ActOnDeclarator(S, D, LastInGroup);
@ -44,7 +44,7 @@ namespace {
/// ActOnPopScope - This callback is called immediately before the specified
/// scope is popped and deleted.
virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {
std::cout << "ActOnPopScope\n";
llvm::cout << "ActOnPopScope\n";
// Pass up to EmptyActions so that the symbol table is maintained right.
MinimalAction::ActOnPopScope(Loc, S);

Просмотреть файл

@ -18,7 +18,7 @@
#include "clang/Lex/Lexer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/MemoryBuffer.h"
#include <iostream>
#include "llvm/Support/Streams.h"
#include <string>
using namespace clang;
@ -40,8 +40,8 @@ PrintIncludeStack(FullSourceLoc Pos) {
PrintIncludeStack(Pos.getIncludeLoc());
unsigned LineNo = Pos.getLineNumber();
std::cerr << "In file included from " << Pos.getSourceName()
<< ":" << LineNo << ":\n";
llvm::cerr << "In file included from " << Pos.getSourceName()
<< ":" << LineNo << ":\n";
}
/// HighlightRange - Given a SourceRange and a line number, highlight (with ~'s)
@ -141,23 +141,23 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
*LineEnd != '\n' && *LineEnd != '\r')
++LineEnd;
std::cerr << Buffer->getBufferIdentifier()
<< ":" << LineNo << ":";
llvm::cerr << Buffer->getBufferIdentifier()
<< ":" << LineNo << ":";
if (ColNo && !NoShowColumn)
std::cerr << ColNo << ":";
std::cerr << " ";
llvm::cerr << ColNo << ":";
llvm::cerr << " ";
}
switch (Level) {
default: assert(0 && "Unknown diagnostic type!");
case Diagnostic::Note: std::cerr << "note: "; break;
case Diagnostic::Warning: std::cerr << "warning: "; break;
case Diagnostic::Error: std::cerr << "error: "; break;
case Diagnostic::Fatal: std::cerr << "fatal error: "; break;
case Diagnostic::Note: llvm::cerr << "note: "; break;
case Diagnostic::Warning: llvm::cerr << "warning: "; break;
case Diagnostic::Error: llvm::cerr << "error: "; break;
case Diagnostic::Fatal: llvm::cerr << "fatal error: "; break;
break;
}
std::cerr << FormatDiagnostic(Diags, Level, ID, Strs, NumStrs) << "\n";
llvm::cerr << FormatDiagnostic(Diags, Level, ID, Strs, NumStrs) << "\n";
if (!NoCaretDiagnostics && Pos.isValid()) {
// Get the line of the source file.
@ -202,7 +202,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
CaratLine.erase(CaratLine.end()-1);
// Emit what we have computed.
std::cerr << SourceLine << "\n";
std::cerr << CaratLine << "\n";
llvm::cerr << SourceLine << "\n";
llvm::cerr << CaratLine << "\n";
}
}

Просмотреть файл

@ -37,7 +37,7 @@
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/MemoryBuffer.h"
#include <iostream>
#include "llvm/Support/Streams.h"
#include <ctime>
using namespace clang;
@ -129,72 +129,72 @@ void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
}
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
std::cerr << tok::getTokenName(Tok.getKind()) << " '"
<< getSpelling(Tok) << "'";
llvm::cerr << tok::getTokenName(Tok.getKind()) << " '"
<< getSpelling(Tok) << "'";
if (!DumpFlags) return;
std::cerr << "\t";
llvm::cerr << "\t";
if (Tok.isAtStartOfLine())
std::cerr << " [StartOfLine]";
llvm::cerr << " [StartOfLine]";
if (Tok.hasLeadingSpace())
std::cerr << " [LeadingSpace]";
llvm::cerr << " [LeadingSpace]";
if (Tok.isExpandDisabled())
std::cerr << " [ExpandDisabled]";
llvm::cerr << " [ExpandDisabled]";
if (Tok.needsCleaning()) {
const char *Start = SourceMgr.getCharacterData(Tok.getLocation());
std::cerr << " [UnClean='" << std::string(Start, Start+Tok.getLength())
<< "']";
llvm::cerr << " [UnClean='" << std::string(Start, Start+Tok.getLength())
<< "']";
}
std::cerr << "\tLoc=<";
llvm::cerr << "\tLoc=<";
DumpLocation(Tok.getLocation());
std::cerr << ">";
llvm::cerr << ">";
}
void Preprocessor::DumpLocation(SourceLocation Loc) const {
SourceLocation LogLoc = SourceMgr.getLogicalLoc(Loc);
std::cerr << SourceMgr.getSourceName(LogLoc) << ':'
<< SourceMgr.getLineNumber(LogLoc) << ':'
<< SourceMgr.getLineNumber(LogLoc);
llvm::cerr << SourceMgr.getSourceName(LogLoc) << ':'
<< SourceMgr.getLineNumber(LogLoc) << ':'
<< SourceMgr.getLineNumber(LogLoc);
SourceLocation PhysLoc = SourceMgr.getPhysicalLoc(Loc);
if (PhysLoc != LogLoc) {
std::cerr << " <PhysLoc=";
llvm::cerr << " <PhysLoc=";
DumpLocation(PhysLoc);
std::cerr << ">";
llvm::cerr << ">";
}
}
void Preprocessor::DumpMacro(const MacroInfo &MI) const {
std::cerr << "MACRO: ";
llvm::cerr << "MACRO: ";
for (unsigned i = 0, e = MI.getNumTokens(); i != e; ++i) {
DumpToken(MI.getReplacementToken(i));
std::cerr << " ";
llvm::cerr << " ";
}
std::cerr << "\n";
llvm::cerr << "\n";
}
void Preprocessor::PrintStats() {
std::cerr << "\n*** Preprocessor Stats:\n";
std::cerr << NumDirectives << " directives found:\n";
std::cerr << " " << NumDefined << " #define.\n";
std::cerr << " " << NumUndefined << " #undef.\n";
std::cerr << " #include/#include_next/#import:\n";
std::cerr << " " << NumEnteredSourceFiles << " source files entered.\n";
std::cerr << " " << MaxIncludeStackDepth << " max include stack depth\n";
std::cerr << " " << NumIf << " #if/#ifndef/#ifdef.\n";
std::cerr << " " << NumElse << " #else/#elif.\n";
std::cerr << " " << NumEndif << " #endif.\n";
std::cerr << " " << NumPragma << " #pragma.\n";
std::cerr << NumSkipped << " #if/#ifndef#ifdef regions skipped\n";
llvm::cerr << "\n*** Preprocessor Stats:\n";
llvm::cerr << NumDirectives << " directives found:\n";
llvm::cerr << " " << NumDefined << " #define.\n";
llvm::cerr << " " << NumUndefined << " #undef.\n";
llvm::cerr << " #include/#include_next/#import:\n";
llvm::cerr << " " << NumEnteredSourceFiles << " source files entered.\n";
llvm::cerr << " " << MaxIncludeStackDepth << " max include stack depth\n";
llvm::cerr << " " << NumIf << " #if/#ifndef/#ifdef.\n";
llvm::cerr << " " << NumElse << " #else/#elif.\n";
llvm::cerr << " " << NumEndif << " #endif.\n";
llvm::cerr << " " << NumPragma << " #pragma.\n";
llvm::cerr << NumSkipped << " #if/#ifndef#ifdef regions skipped\n";
std::cerr << NumMacroExpanded << "/" << NumFnMacroExpanded << "/"
<< NumBuiltinMacroExpanded << " obj/fn/builtin macros expanded, "
<< NumFastMacroExpanded << " on the fast path.\n";
std::cerr << (NumFastTokenPaste+NumTokenPaste)
<< " token paste (##) operations performed, "
<< NumFastTokenPaste << " on the fast path.\n";
llvm::cerr << NumMacroExpanded << "/" << NumFnMacroExpanded << "/"
<< NumBuiltinMacroExpanded << " obj/fn/builtin macros expanded, "
<< NumFastMacroExpanded << " on the fast path.\n";
llvm::cerr << (NumFastTokenPaste+NumTokenPaste)
<< " token paste (##) operations performed, "
<< NumFastTokenPaste << " on the fast path.\n";
}
//===----------------------------------------------------------------------===//