Kill a few more random stderr uses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90441 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/TypePrinter.cpp b/lib/AST/TypePrinter.cpp
index 562e830..8393253 100644
--- a/lib/AST/TypePrinter.cpp
+++ b/lib/AST/TypePrinter.cpp
@@ -683,9 +683,8 @@
LangOptions LO;
getAsStringInternal(R, PrintingPolicy(LO));
if (msg)
- fprintf(stderr, "%s: %s\n", msg, R.c_str());
- else
- fprintf(stderr, "%s\n", R.c_str());
+ llvm::errs() << msg << ": ";
+ llvm::errs() << R << "\n";
}
void QualType::dump() const {
dump("");
diff --git a/lib/Frontend/ASTConsumers.cpp b/lib/Frontend/ASTConsumers.cpp
index 9a30f59..e90e7fc 100644
--- a/lib/Frontend/ASTConsumers.cpp
+++ b/lib/Frontend/ASTConsumers.cpp
@@ -28,8 +28,6 @@
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
-#include <cstdio>
-
using namespace clang;
//===----------------------------------------------------------------------===//
@@ -406,7 +404,7 @@
break;
}
default:
- fprintf(stderr, "DeclKind: %d \"%s\"\n", DK, I->getDeclKindName());
+ Out << "DeclKind: " << DK << '"' << I->getDeclKindName() << "\"\n";
assert(0 && "decl unhandled");
}
}
diff --git a/lib/Frontend/DiagChecker.cpp b/lib/Frontend/DiagChecker.cpp
index e7a66b1..a50cc99 100644
--- a/lib/Frontend/DiagChecker.cpp
+++ b/lib/Frontend/DiagChecker.cpp
@@ -17,7 +17,7 @@
#include "clang/AST/ASTConsumer.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Preprocessor.h"
-#include <cstdio>
+#include "llvm/Support/raw_ostream.h"
using namespace clang;
typedef TextDiagnosticBuffer::DiagList DiagList;
@@ -190,12 +190,10 @@
const char *Msg) {
if (diag_begin == diag_end) return false;
- fprintf(stderr, "%s\n", Msg);
-
+ llvm::errs() << Msg << "\n";
for (const_diag_iterator I = diag_begin, E = diag_end; I != E; ++I)
- fprintf(stderr, " Line %d: %s\n",
- SourceMgr.getInstantiationLineNumber(I->first),
- I->second.c_str());
+ llvm::errs() << " Line " << SourceMgr.getInstantiationLineNumber(I->first)
+ << " " << I->second << "\n";
return true;
}
diff --git a/lib/Frontend/FixItRewriter.cpp b/lib/Frontend/FixItRewriter.cpp
index dddcaa9..4fa2b3c 100644
--- a/lib/Frontend/FixItRewriter.cpp
+++ b/lib/Frontend/FixItRewriter.cpp
@@ -66,7 +66,7 @@
Rewrite.getRewriteBufferFor(MainFileID)) {
*OutFile << std::string(RewriteBuf->begin(), RewriteBuf->end());
} else {
- std::fprintf(stderr, "Main file is unchanged\n");
+ Diag(FullSourceLoc(), diag::note_fixit_main_file_unchanged);
}
OutFile->flush();
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index a40a569..9327c3f 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -24,7 +24,6 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include "llvm/Config/config.h"
-#include <cstdio>
#ifdef _MSC_VER
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
@@ -643,11 +642,11 @@
}
if (Verbose) {
- fprintf(stderr, "ignoring duplicate directory \"%s\"\n",
- CurEntry.getName());
+ llvm::errs() << "ignoring duplicate directory \""
+ << CurEntry.getName() << "\"\n";
if (DirToRemove != i)
- fprintf(stderr, " as it is a non-system directory that duplicates"
- " a system directory\n");
+ llvm::errs() << " as it is a non-system directory that duplicates "
+ << "a system directory\n";
}
// This is reached if the current entry is a duplicate. Remove the
@@ -680,11 +679,11 @@
// If verbose, print the list of directories that will be searched.
if (Verbose) {
- fprintf(stderr, "#include \"...\" search starts here:\n");
+ llvm::errs() << "#include \"...\" search starts here:\n";
unsigned QuotedIdx = IncludeGroup[Quoted].size();
for (unsigned i = 0, e = SearchList.size(); i != e; ++i) {
if (i == QuotedIdx)
- fprintf(stderr, "#include <...> search starts here:\n");
+ llvm::errs() << "#include <...> search starts here:\n";
const char *Name = SearchList[i].getName();
const char *Suffix;
if (SearchList[i].isNormalDir())
@@ -695,9 +694,9 @@
assert(SearchList[i].isHeaderMap() && "Unknown DirectoryLookup");
Suffix = " (headermap)";
}
- fprintf(stderr, " %s%s\n", Name, Suffix);
+ llvm::errs() << " " << Name << Suffix << "\n";
}
- fprintf(stderr, "End of search list.\n");
+ llvm::errs() << "End of search list.\n";
}
}