Hook up HTMLDiagnostics to use Chris's new syntax highlighting. --html-diags
currently doesn't pass in the Preprocessor from the driver, so we don't get
syntax highlighting when we create HTMLDiagnostics in that way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49796 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index 3f4b4e2..16299c4 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -624,7 +624,7 @@
}
//===----------------------------------------------------------------------===//
-// CheckeRConsumer - Generic Driver for running intra-procedural path-sensitive
+// CheckerConsumer - Generic Driver for running intra-procedural path-sensitive
// analyses.
namespace {
@@ -633,16 +633,18 @@
protected:
Diagnostic &Diags;
ASTContext* Ctx;
+ Preprocessor* PP;
const std::string& HTMLDir;
bool Visualize;
bool TrimGraph;
llvm::OwningPtr<PathDiagnosticClient> PD;
bool AnalyzeAll;
public:
- CheckerConsumer(Diagnostic &diags, const std::string& fname,
- const std::string& htmldir,
- bool visualize, bool trim, bool analyzeAll)
- : CFGVisitor(fname), Diags(diags), HTMLDir(htmldir),
+ CheckerConsumer(Diagnostic &diags, Preprocessor* pp,
+ const std::string& fname,
+ const std::string& htmldir,
+ bool visualize, bool trim, bool analyzeAll)
+ : CFGVisitor(fname), Diags(diags), PP(pp), HTMLDir(htmldir),
Visualize(visualize), TrimGraph(trim), AnalyzeAll(analyzeAll) {}
virtual void Initialize(ASTContext &Context) { Ctx = &Context; }
@@ -670,7 +672,7 @@
// Lazily create the diagnostic client.
if (!HTMLDir.empty() && PD.get() == NULL)
- PD.reset(CreateHTMLDiagnosticClient(HTMLDir));
+ PD.reset(CreateHTMLDiagnosticClient(HTMLDir, PP));
if (!Visualize) {
@@ -716,10 +718,10 @@
namespace {
class GRSimpleValsVisitor : public CheckerConsumer {
public:
- GRSimpleValsVisitor(Diagnostic &diags, const std::string& fname,
- const std::string& htmldir,
+ GRSimpleValsVisitor(Diagnostic &diags, Preprocessor* pp,
+ const std::string& fname, const std::string& htmldir,
bool visualize, bool trim, bool analyzeAll)
- : CheckerConsumer(diags, fname, htmldir, visualize, trim, analyzeAll) {}
+ : CheckerConsumer(diags, pp, fname, htmldir, visualize, trim, analyzeAll) {}
virtual const char* getCheckerName() { return "GRSimpleVals"; }
@@ -730,12 +732,13 @@
} // end anonymous namespace
ASTConsumer* clang::CreateGRSimpleVals(Diagnostic &Diags,
+ Preprocessor* PP,
const std::string& FunctionName,
const std::string& HTMLDir,
bool Visualize, bool TrimGraph,
bool AnalyzeAll) {
- return new GRSimpleValsVisitor(Diags, FunctionName, HTMLDir,
+ return new GRSimpleValsVisitor(Diags, PP, FunctionName, HTMLDir,
Visualize, TrimGraph, AnalyzeAll);
}
@@ -746,10 +749,11 @@
namespace {
class CFRefCountCheckerVisitor : public CheckerConsumer {
public:
- CFRefCountCheckerVisitor(Diagnostic &diags, const std::string& fname,
- const std::string& htmldir,
- bool visualize, bool trim, bool analyzeAll)
- : CheckerConsumer(diags, fname, htmldir, visualize, trim, analyzeAll) {}
+ CFRefCountCheckerVisitor(Diagnostic &diags, Preprocessor* pp,
+ const std::string& fname,
+ const std::string& htmldir,
+ bool visualize, bool trim, bool analyzeAll)
+ : CheckerConsumer(diags, pp, fname, htmldir, visualize, trim, analyzeAll) {}
virtual const char* getCheckerName() { return "CFRefCountChecker"; }
@@ -760,12 +764,13 @@
} // end anonymous namespace
ASTConsumer* clang::CreateCFRefChecker(Diagnostic &Diags,
+ Preprocessor* PP,
const std::string& FunctionName,
const std::string& HTMLDir,
bool Visualize, bool TrimGraph,
bool AnalyzeAll) {
- return new CFRefCountCheckerVisitor(Diags, FunctionName, HTMLDir,
+ return new CFRefCountCheckerVisitor(Diags, PP, FunctionName, HTMLDir,
Visualize, TrimGraph, AnalyzeAll);
}