forked from OSchip/llvm-project
Bug #:
Submitted by: Bill Wendling - Convert std::cerr to using fprintf(stderr, ...) instead. llvm-svn: 39675
This commit is contained in:
parent
54fb19efaa
commit
26e1f8c05a
|
@ -34,7 +34,6 @@
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
#include <iostream>
|
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -491,7 +490,8 @@ static void AddPath(const std::string &Path, IncludeDirGroup Group,
|
||||||
const DirectoryEntry *DE = FM.getDirectory(Path);
|
const DirectoryEntry *DE = FM.getDirectory(Path);
|
||||||
if (DE == 0) {
|
if (DE == 0) {
|
||||||
if (Verbose)
|
if (Verbose)
|
||||||
std::cerr << "ignoring nonexistent directory \"" << Path << "\"\n";
|
fprintf(stderr, "ignoring nonexistent directory \"%s\"\n",
|
||||||
|
Path.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,8 +515,8 @@ static void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList) {
|
||||||
// If this isn't the first time we've seen this dir, remove it.
|
// If this isn't the first time we've seen this dir, remove it.
|
||||||
if (!SeenDirs.insert(SearchList[i].getDir()).second) {
|
if (!SeenDirs.insert(SearchList[i].getDir()).second) {
|
||||||
if (Verbose)
|
if (Verbose)
|
||||||
std::cerr << "ignoring duplicate directory \""
|
fprintf(stderr, "ignoring duplicate directory \"%s\"\n",
|
||||||
<< SearchList[i].getDir()->getName() << "\"\n";
|
SearchList[i].getDir()->getName());
|
||||||
SearchList.erase(SearchList.begin()+i);
|
SearchList.erase(SearchList.begin()+i);
|
||||||
--i;
|
--i;
|
||||||
}
|
}
|
||||||
|
@ -654,12 +654,12 @@ static void InitializeIncludePaths(HeaderSearch &Headers, FileManager &FM,
|
||||||
|
|
||||||
// If verbose, print the list of directories that will be searched.
|
// If verbose, print the list of directories that will be searched.
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
std::cerr << "#include \"...\" search starts here:\n";
|
fprintf(stderr, "#include \"...\" search starts here:\n");
|
||||||
unsigned QuotedIdx = IncludeGroup[Quoted].size();
|
unsigned QuotedIdx = IncludeGroup[Quoted].size();
|
||||||
for (unsigned i = 0, e = SearchList.size(); i != e; ++i) {
|
for (unsigned i = 0, e = SearchList.size(); i != e; ++i) {
|
||||||
if (i == QuotedIdx)
|
if (i == QuotedIdx)
|
||||||
std::cerr << "#include <...> search starts here:\n";
|
fprintf(stderr, "#include <...> search starts here:\n");
|
||||||
std::cerr << " " << SearchList[i].getDir()->getName() << "\n";
|
fprintf(stderr, " %s\n", SearchList[i].getDir()->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,7 +699,7 @@ static void BuildASTs(Preprocessor &PP, unsigned MainFileID) {
|
||||||
/* keep reading */;
|
/* keep reading */;
|
||||||
|
|
||||||
if (Stats) {
|
if (Stats) {
|
||||||
std::cerr << "\nSTATISTICS:\n";
|
fprintf(stderr, "\nSTATISTICS:\n");
|
||||||
ASTStreamer_PrintStats(Streamer);
|
ASTStreamer_PrintStats(Streamer);
|
||||||
Context.PrintStats();
|
Context.PrintStats();
|
||||||
Decl::PrintStats();
|
Decl::PrintStats();
|
||||||
|
@ -736,21 +736,21 @@ static void PrintFunctionDecl(FunctionDecl *FD) {
|
||||||
}
|
}
|
||||||
AFT->getResultType().getAsStringInternal(Proto);
|
AFT->getResultType().getAsStringInternal(Proto);
|
||||||
|
|
||||||
std::cerr << "\n" << Proto;
|
fprintf(stderr, "\n%s", Proto.c_str());
|
||||||
|
|
||||||
if (FD->getBody()) {
|
if (FD->getBody()) {
|
||||||
std::cerr << " ";
|
fprintf(stderr, " ");
|
||||||
FD->getBody()->dump();
|
FD->getBody()->dump();
|
||||||
std::cerr << "\n";
|
fprintf(stderr, "\n");
|
||||||
} else {
|
} else {
|
||||||
std::cerr << ";\n";
|
fprintf(stderr, ";\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintTypeDefDecl(TypedefDecl *TD) {
|
static void PrintTypeDefDecl(TypedefDecl *TD) {
|
||||||
std::string S = TD->getName();
|
std::string S = TD->getName();
|
||||||
TD->getUnderlyingType().getAsStringInternal(S);
|
TD->getUnderlyingType().getAsStringInternal(S);
|
||||||
std::cerr << "typedef " << S << ";\n";
|
fprintf(stderr, "typedef %s;\n", S.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintASTs(Preprocessor &PP, unsigned MainFileID) {
|
static void PrintASTs(Preprocessor &PP, unsigned MainFileID) {
|
||||||
|
@ -763,12 +763,12 @@ static void PrintASTs(Preprocessor &PP, unsigned MainFileID) {
|
||||||
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
|
} else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
|
||||||
PrintTypeDefDecl(TD);
|
PrintTypeDefDecl(TD);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Read top-level variable decl: '" << D->getName() << "'\n";
|
fprintf(stderr, "Read top-level variable decl: '%s'\n", D->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Stats) {
|
if (Stats) {
|
||||||
std::cerr << "\nSTATISTICS:\n";
|
fprintf(stderr, "\nSTATISTICS:\n");
|
||||||
ASTStreamer_PrintStats(Streamer);
|
ASTStreamer_PrintStats(Streamer);
|
||||||
Context.PrintStats();
|
Context.PrintStats();
|
||||||
}
|
}
|
||||||
|
@ -804,14 +804,14 @@ static unsigned InitializePreprocessor(Preprocessor &PP,
|
||||||
const FileEntry *File = FileMgr.getFile(InFile);
|
const FileEntry *File = FileMgr.getFile(InFile);
|
||||||
if (File) MainFileID = SourceMgr.createFileID(File, SourceLocation());
|
if (File) MainFileID = SourceMgr.createFileID(File, SourceLocation());
|
||||||
if (MainFileID == 0) {
|
if (MainFileID == 0) {
|
||||||
std::cerr << "Error reading '" << InFile << "'!\n";
|
fprintf(stderr, "Error reading '%s'!\n",InFile.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN();
|
llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN();
|
||||||
if (SB) MainFileID = SourceMgr.createFileIDForMemBuffer(SB);
|
if (SB) MainFileID = SourceMgr.createFileIDForMemBuffer(SB);
|
||||||
if (MainFileID == 0) {
|
if (MainFileID == 0) {
|
||||||
std::cerr << "Error reading standard input! Empty?\n";
|
fprintf(stderr, "Error reading standard input! Empty?\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -857,7 +857,7 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
|
||||||
do {
|
do {
|
||||||
PP.Lex(Tok);
|
PP.Lex(Tok);
|
||||||
PP.DumpToken(Tok, true);
|
PP.DumpToken(Tok, true);
|
||||||
std::cerr << "\n";
|
fprintf(stderr, "\n");
|
||||||
} while (Tok.getKind() != tok::eof);
|
} while (Tok.getKind() != tok::eof);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -895,11 +895,11 @@ static void ProcessInputFile(Preprocessor &PP, unsigned MainFileID,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Stats) {
|
if (Stats) {
|
||||||
std::cerr << "\nSTATISTICS FOR '" << InFile << "':\n";
|
fprintf(stderr, "\nSTATISTICS FOR '%s':\n", InFile.c_str());
|
||||||
PP.PrintStats();
|
PP.PrintStats();
|
||||||
PP.getIdentifierTable().PrintStats();
|
PP.getIdentifierTable().PrintStats();
|
||||||
HeaderInfo.PrintStats();
|
HeaderInfo.PrintStats();
|
||||||
std::cerr << "\n";
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
HeaderInfo.ClearFileInfo();
|
HeaderInfo.ClearFileInfo();
|
||||||
|
@ -942,7 +942,8 @@ int main(int argc, char **argv) {
|
||||||
// driver.
|
// driver.
|
||||||
TargetInfo *Target = CreateTargetInfo(Diags);
|
TargetInfo *Target = CreateTargetInfo(Diags);
|
||||||
if (Target == 0) {
|
if (Target == 0) {
|
||||||
std::cerr << "Sorry, don't know what target this is, please use -arch.\n";
|
fprintf(stderr,
|
||||||
|
"Sorry, don't know what target this is, please use -arch.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,15 +968,14 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
unsigned NumDiagnostics = Diags.getNumDiagnostics();
|
unsigned NumDiagnostics = Diags.getNumDiagnostics();
|
||||||
if (NumDiagnostics)
|
if (NumDiagnostics)
|
||||||
std::cerr << NumDiagnostics << " diagnostic"
|
fprintf(stderr, "%d diagnostic%s generated.\n", NumDiagnostics,
|
||||||
<< (NumDiagnostics == 1 ? "" : "s")
|
(NumDiagnostics == 1 ? "" : "s"));
|
||||||
<< " generated.\n";
|
|
||||||
|
|
||||||
if (Stats) {
|
if (Stats) {
|
||||||
// Printed from high-to-low level.
|
// Printed from high-to-low level.
|
||||||
SourceMgr.PrintStats();
|
SourceMgr.PrintStats();
|
||||||
FileMgr.PrintStats();
|
FileMgr.PrintStats();
|
||||||
std::cerr << "\n";
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Diags.getNumErrors() != 0;
|
return Diags.getNumErrors() != 0;
|
||||||
|
|
Loading…
Reference in New Issue