mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-03 01:16:13 +00:00
Change uses of std::cerr/std::cout to llvm::Lcerr/llvm::cout, and remove
#include<iostream>. Patch provided by Sam Bishop. llvm-svn: 45962
This commit is contained in:
parent
4871fe0b8f
commit
a0a3e9bb07
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include "clang/AST/StmtGraphTraits.h"
|
#include "clang/AST/StmtGraphTraits.h"
|
||||||
#include "llvm/Support/GraphWriter.h"
|
#include "llvm/Support/GraphWriter.h"
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
@ -23,7 +22,7 @@ void Stmt::viewAST() const {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
llvm::ViewGraph(this,"AST");
|
llvm::ViewGraph(this,"AST");
|
||||||
#else
|
#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";
|
<< "systems with Graphviz or gv!\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "clang.h"
|
#include "clang.h"
|
||||||
#include "clang/Parse/Action.h"
|
#include "clang/Parse/Action.h"
|
||||||
#include "clang/Parse/DeclSpec.h"
|
#include "clang/Parse/DeclSpec.h"
|
||||||
#include <iostream>
|
#include "llvm/Support/Streams.h"
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -29,13 +29,13 @@ namespace {
|
|||||||
/// "int X = 4" or "typedef int foo".
|
/// "int X = 4" or "typedef int foo".
|
||||||
virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,
|
virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D,
|
||||||
DeclTy *LastInGroup) {
|
DeclTy *LastInGroup) {
|
||||||
std::cout << "ActOnDeclarator ";
|
llvm::cout << "ActOnDeclarator ";
|
||||||
if (IdentifierInfo *II = D.getIdentifier()) {
|
if (IdentifierInfo *II = D.getIdentifier()) {
|
||||||
std::cout << "'" << II->getName() << "'";
|
llvm::cout << "'" << II->getName() << "'";
|
||||||
} else {
|
} 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.
|
// Pass up to EmptyActions so that the symbol table is maintained right.
|
||||||
return MinimalAction::ActOnDeclarator(S, D, LastInGroup);
|
return MinimalAction::ActOnDeclarator(S, D, LastInGroup);
|
||||||
@ -44,7 +44,7 @@ namespace {
|
|||||||
/// ActOnPopScope - This callback is called immediately before the specified
|
/// ActOnPopScope - This callback is called immediately before the specified
|
||||||
/// scope is popped and deleted.
|
/// scope is popped and deleted.
|
||||||
virtual void ActOnPopScope(SourceLocation Loc, Scope *S) {
|
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.
|
// Pass up to EmptyActions so that the symbol table is maintained right.
|
||||||
MinimalAction::ActOnPopScope(Loc, S);
|
MinimalAction::ActOnPopScope(Loc, S);
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "clang/Lex/Lexer.h"
|
#include "clang/Lex/Lexer.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include <iostream>
|
#include "llvm/Support/Streams.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ PrintIncludeStack(FullSourceLoc Pos) {
|
|||||||
PrintIncludeStack(Pos.getIncludeLoc());
|
PrintIncludeStack(Pos.getIncludeLoc());
|
||||||
unsigned LineNo = Pos.getLineNumber();
|
unsigned LineNo = Pos.getLineNumber();
|
||||||
|
|
||||||
std::cerr << "In file included from " << Pos.getSourceName()
|
llvm::cerr << "In file included from " << Pos.getSourceName()
|
||||||
<< ":" << LineNo << ":\n";
|
<< ":" << LineNo << ":\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// HighlightRange - Given a SourceRange and a line number, highlight (with ~'s)
|
/// 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 != '\n' && *LineEnd != '\r')
|
||||||
++LineEnd;
|
++LineEnd;
|
||||||
|
|
||||||
std::cerr << Buffer->getBufferIdentifier()
|
llvm::cerr << Buffer->getBufferIdentifier()
|
||||||
<< ":" << LineNo << ":";
|
<< ":" << LineNo << ":";
|
||||||
if (ColNo && !NoShowColumn)
|
if (ColNo && !NoShowColumn)
|
||||||
std::cerr << ColNo << ":";
|
llvm::cerr << ColNo << ":";
|
||||||
std::cerr << " ";
|
llvm::cerr << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Level) {
|
switch (Level) {
|
||||||
default: assert(0 && "Unknown diagnostic type!");
|
default: assert(0 && "Unknown diagnostic type!");
|
||||||
case Diagnostic::Note: std::cerr << "note: "; break;
|
case Diagnostic::Note: llvm::cerr << "note: "; break;
|
||||||
case Diagnostic::Warning: std::cerr << "warning: "; break;
|
case Diagnostic::Warning: llvm::cerr << "warning: "; break;
|
||||||
case Diagnostic::Error: std::cerr << "error: "; break;
|
case Diagnostic::Error: llvm::cerr << "error: "; break;
|
||||||
case Diagnostic::Fatal: std::cerr << "fatal error: "; break;
|
case Diagnostic::Fatal: llvm::cerr << "fatal error: "; break;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << FormatDiagnostic(Diags, Level, ID, Strs, NumStrs) << "\n";
|
llvm::cerr << FormatDiagnostic(Diags, Level, ID, Strs, NumStrs) << "\n";
|
||||||
|
|
||||||
if (!NoCaretDiagnostics && Pos.isValid()) {
|
if (!NoCaretDiagnostics && Pos.isValid()) {
|
||||||
// Get the line of the source file.
|
// Get the line of the source file.
|
||||||
@ -202,7 +202,7 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic &Diags,
|
|||||||
CaratLine.erase(CaratLine.end()-1);
|
CaratLine.erase(CaratLine.end()-1);
|
||||||
|
|
||||||
// Emit what we have computed.
|
// Emit what we have computed.
|
||||||
std::cerr << SourceLine << "\n";
|
llvm::cerr << SourceLine << "\n";
|
||||||
std::cerr << CaratLine << "\n";
|
llvm::cerr << CaratLine << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "clang/Basic/TargetInfo.h"
|
#include "clang/Basic/TargetInfo.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include <iostream>
|
#include "llvm/Support/Streams.h"
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
@ -129,72 +129,72 @@ void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
|
void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
|
||||||
std::cerr << tok::getTokenName(Tok.getKind()) << " '"
|
llvm::cerr << tok::getTokenName(Tok.getKind()) << " '"
|
||||||
<< getSpelling(Tok) << "'";
|
<< getSpelling(Tok) << "'";
|
||||||
|
|
||||||
if (!DumpFlags) return;
|
if (!DumpFlags) return;
|
||||||
|
|
||||||
std::cerr << "\t";
|
llvm::cerr << "\t";
|
||||||
if (Tok.isAtStartOfLine())
|
if (Tok.isAtStartOfLine())
|
||||||
std::cerr << " [StartOfLine]";
|
llvm::cerr << " [StartOfLine]";
|
||||||
if (Tok.hasLeadingSpace())
|
if (Tok.hasLeadingSpace())
|
||||||
std::cerr << " [LeadingSpace]";
|
llvm::cerr << " [LeadingSpace]";
|
||||||
if (Tok.isExpandDisabled())
|
if (Tok.isExpandDisabled())
|
||||||
std::cerr << " [ExpandDisabled]";
|
llvm::cerr << " [ExpandDisabled]";
|
||||||
if (Tok.needsCleaning()) {
|
if (Tok.needsCleaning()) {
|
||||||
const char *Start = SourceMgr.getCharacterData(Tok.getLocation());
|
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());
|
DumpLocation(Tok.getLocation());
|
||||||
std::cerr << ">";
|
llvm::cerr << ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preprocessor::DumpLocation(SourceLocation Loc) const {
|
void Preprocessor::DumpLocation(SourceLocation Loc) const {
|
||||||
SourceLocation LogLoc = SourceMgr.getLogicalLoc(Loc);
|
SourceLocation LogLoc = SourceMgr.getLogicalLoc(Loc);
|
||||||
std::cerr << SourceMgr.getSourceName(LogLoc) << ':'
|
llvm::cerr << SourceMgr.getSourceName(LogLoc) << ':'
|
||||||
<< SourceMgr.getLineNumber(LogLoc) << ':'
|
<< SourceMgr.getLineNumber(LogLoc) << ':'
|
||||||
<< SourceMgr.getLineNumber(LogLoc);
|
<< SourceMgr.getLineNumber(LogLoc);
|
||||||
|
|
||||||
SourceLocation PhysLoc = SourceMgr.getPhysicalLoc(Loc);
|
SourceLocation PhysLoc = SourceMgr.getPhysicalLoc(Loc);
|
||||||
if (PhysLoc != LogLoc) {
|
if (PhysLoc != LogLoc) {
|
||||||
std::cerr << " <PhysLoc=";
|
llvm::cerr << " <PhysLoc=";
|
||||||
DumpLocation(PhysLoc);
|
DumpLocation(PhysLoc);
|
||||||
std::cerr << ">";
|
llvm::cerr << ">";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preprocessor::DumpMacro(const MacroInfo &MI) const {
|
void Preprocessor::DumpMacro(const MacroInfo &MI) const {
|
||||||
std::cerr << "MACRO: ";
|
llvm::cerr << "MACRO: ";
|
||||||
for (unsigned i = 0, e = MI.getNumTokens(); i != e; ++i) {
|
for (unsigned i = 0, e = MI.getNumTokens(); i != e; ++i) {
|
||||||
DumpToken(MI.getReplacementToken(i));
|
DumpToken(MI.getReplacementToken(i));
|
||||||
std::cerr << " ";
|
llvm::cerr << " ";
|
||||||
}
|
}
|
||||||
std::cerr << "\n";
|
llvm::cerr << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preprocessor::PrintStats() {
|
void Preprocessor::PrintStats() {
|
||||||
std::cerr << "\n*** Preprocessor Stats:\n";
|
llvm::cerr << "\n*** Preprocessor Stats:\n";
|
||||||
std::cerr << NumDirectives << " directives found:\n";
|
llvm::cerr << NumDirectives << " directives found:\n";
|
||||||
std::cerr << " " << NumDefined << " #define.\n";
|
llvm::cerr << " " << NumDefined << " #define.\n";
|
||||||
std::cerr << " " << NumUndefined << " #undef.\n";
|
llvm::cerr << " " << NumUndefined << " #undef.\n";
|
||||||
std::cerr << " #include/#include_next/#import:\n";
|
llvm::cerr << " #include/#include_next/#import:\n";
|
||||||
std::cerr << " " << NumEnteredSourceFiles << " source files entered.\n";
|
llvm::cerr << " " << NumEnteredSourceFiles << " source files entered.\n";
|
||||||
std::cerr << " " << MaxIncludeStackDepth << " max include stack depth\n";
|
llvm::cerr << " " << MaxIncludeStackDepth << " max include stack depth\n";
|
||||||
std::cerr << " " << NumIf << " #if/#ifndef/#ifdef.\n";
|
llvm::cerr << " " << NumIf << " #if/#ifndef/#ifdef.\n";
|
||||||
std::cerr << " " << NumElse << " #else/#elif.\n";
|
llvm::cerr << " " << NumElse << " #else/#elif.\n";
|
||||||
std::cerr << " " << NumEndif << " #endif.\n";
|
llvm::cerr << " " << NumEndif << " #endif.\n";
|
||||||
std::cerr << " " << NumPragma << " #pragma.\n";
|
llvm::cerr << " " << NumPragma << " #pragma.\n";
|
||||||
std::cerr << NumSkipped << " #if/#ifndef#ifdef regions skipped\n";
|
llvm::cerr << NumSkipped << " #if/#ifndef#ifdef regions skipped\n";
|
||||||
|
|
||||||
std::cerr << NumMacroExpanded << "/" << NumFnMacroExpanded << "/"
|
llvm::cerr << NumMacroExpanded << "/" << NumFnMacroExpanded << "/"
|
||||||
<< NumBuiltinMacroExpanded << " obj/fn/builtin macros expanded, "
|
<< NumBuiltinMacroExpanded << " obj/fn/builtin macros expanded, "
|
||||||
<< NumFastMacroExpanded << " on the fast path.\n";
|
<< NumFastMacroExpanded << " on the fast path.\n";
|
||||||
std::cerr << (NumFastTokenPaste+NumTokenPaste)
|
llvm::cerr << (NumFastTokenPaste+NumTokenPaste)
|
||||||
<< " token paste (##) operations performed, "
|
<< " token paste (##) operations performed, "
|
||||||
<< NumFastTokenPaste << " on the fast path.\n";
|
<< NumFastTokenPaste << " on the fast path.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user