diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-17 20:40:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-17 20:40:01 +0000 |
commit | 409d4e716a01a71c4fecfaec59ca8348c8a5d275 (patch) | |
tree | a17adc0a6bdecbb3df4a40a8756bb0032e2967b1 /lib/Frontend/HTMLDiagnostics.cpp | |
parent | 40469651a3f8379dc0f32df69e9bade06a2aad36 (diff) |
refactor htmldiags to be created up front like the other diag clients.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/HTMLDiagnostics.cpp')
-rw-r--r-- | lib/Frontend/HTMLDiagnostics.cpp | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/Frontend/HTMLDiagnostics.cpp b/lib/Frontend/HTMLDiagnostics.cpp index 752d41fb4c..9cfe0b2a61 100644 --- a/lib/Frontend/HTMLDiagnostics.cpp +++ b/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. |