summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-17 20:40:01 +0000
committerChris Lattner <sabre@nondot.org>2009-04-17 20:40:01 +0000
commit25ef69a36e1e756bf11c5ac762a48b0b80098852 (patch)
tree7de3b1474ba96d0379021c5fabc0eb4846f29701 /clang/lib
parentea09d4aca8579fca1af8fed8c6f21035d2aab383 (diff)
downloadbcm5719-llvm-25ef69a36e1e756bf11c5ac762a48b0b80098852.tar.gz
bcm5719-llvm-25ef69a36e1e756bf11c5ac762a48b0b80098852.zip
refactor htmldiags to be created up front like the other diag clients.
llvm-svn: 69379
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/HTMLDiagnostics.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/clang/lib/Frontend/HTMLDiagnostics.cpp b/clang/lib/Frontend/HTMLDiagnostics.cpp
index 752d41fb4c1..9cfe0b2a612 100644
--- a/clang/lib/Frontend/HTMLDiagnostics.cpp
+++ b/clang/lib/Frontend/HTMLDiagnostics.cpp
@@ -39,14 +39,14 @@ class VISIBILITY_HIDDEN HTMLDiagnostics : public PathDiagnosticClient {
llvm::sys::Path Directory, FilePrefix;
bool createdDir, noDir;
Preprocessor* PP;
- PreprocessorFactory* PPF;
std::vector<const PathDiagnostic*> BatchedDiags;
public:
- HTMLDiagnostics(const std::string& prefix, Preprocessor* pp,
- PreprocessorFactory* ppf);
+ HTMLDiagnostics(const std::string& prefix, Preprocessor* pp);
virtual ~HTMLDiagnostics();
+ virtual void SetPreprocessor(Preprocessor *pp) { PP = pp; }
+
virtual void HandlePathDiagnostic(const PathDiagnostic* D);
unsigned ProcessMacroPiece(llvm::raw_ostream& os,
@@ -65,10 +65,9 @@ public:
} // end anonymous namespace
-HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp,
- PreprocessorFactory* ppf)
+HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp)
: Directory(prefix), FilePrefix(prefix), createdDir(false), noDir(false),
- PP(pp), PPF(ppf) {
+ PP(pp) {
// All html files begin with "report"
FilePrefix.appendComponent("report");
@@ -76,9 +75,8 @@ HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp,
PathDiagnosticClient*
clang::CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP,
- PreprocessorFactory* PPF) {
-
- return new HTMLDiagnostics(prefix, PP, PPF);
+ PreprocessorFactory*) {
+ return new HTMLDiagnostics(prefix, PP);
}
//===----------------------------------------------------------------------===//
@@ -99,7 +97,6 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic* D) {
}
HTMLDiagnostics::~HTMLDiagnostics() {
-
while (!BatchedDiags.empty()) {
const PathDiagnostic* D = BatchedDiags.back();
BatchedDiags.pop_back();
@@ -109,9 +106,7 @@ HTMLDiagnostics::~HTMLDiagnostics() {
}
void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
-
// Create the HTML directory if it is missing.
-
if (!createdDir) {
createdDir = true;
std::string ErrorMsg;
@@ -170,10 +165,8 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) {
unsigned max = n;
for (PathDiagnostic::const_reverse_iterator I=D.rbegin(), E=D.rend();
- I!=E; ++I, --n) {
-
+ I!=E; ++I, --n)
HandlePiece(R, FID, *I, n, max);
- }
// Add line numbers, header, footer, etc.
OpenPOWER on IntegriCloud