diff options
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/AnalysisConsumer.cpp | 19 | ||||
-rw-r--r-- | lib/Frontend/HTMLDiagnostics.cpp | 10 | ||||
-rw-r--r-- | lib/Frontend/HTMLPrint.cpp | 36 | ||||
-rw-r--r-- | lib/Frontend/PlistDiagnostics.cpp | 4 |
4 files changed, 28 insertions, 41 deletions
diff --git a/lib/Frontend/AnalysisConsumer.cpp b/lib/Frontend/AnalysisConsumer.cpp index 049f3bd3ea..714ede4a6d 100644 --- a/lib/Frontend/AnalysisConsumer.cpp +++ b/lib/Frontend/AnalysisConsumer.cpp @@ -52,12 +52,11 @@ namespace { //===----------------------------------------------------------------------===// static PathDiagnosticClient* -CreatePlistHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP, - PreprocessorFactory* PPF) { +CreatePlistHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP) { llvm::sys::Path F(prefix); PathDiagnosticClientFactory *PF = - CreateHTMLDiagnosticClientFactory(F.getDirname(), PP, PPF); - return CreatePlistDiagnosticClient(prefix, PP, PPF, PF); + CreateHTMLDiagnosticClientFactory(F.getDirname(), PP); + return CreatePlistDiagnosticClient(prefix, PP, PF); } //===----------------------------------------------------------------------===// @@ -78,7 +77,6 @@ namespace { Diagnostic &Diags; ASTContext* Ctx; Preprocessor* PP; - PreprocessorFactory* PPF; const std::string OutDir; AnalyzerOptions Opts; @@ -92,13 +90,11 @@ namespace { llvm::OwningPtr<AnalysisManager> Mgr; AnalysisConsumer(Diagnostic &diags, Preprocessor* pp, - PreprocessorFactory* ppf, const LangOptions& lopts, const std::string& outdir, const AnalyzerOptions& opts) - : LOpts(lopts), Diags(diags), - Ctx(0), PP(pp), PPF(ppf), - OutDir(outdir), Opts(opts), PD(0) { + : LOpts(lopts), Diags(diags), Ctx(0), PP(pp), OutDir(outdir), + Opts(opts), PD(0) { DigestAnalyzerOptions(); } @@ -108,7 +104,7 @@ namespace { switch (Opts.AnalysisDiagOpt) { default: #define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN, AUTOCREATE) \ - case PD_##NAME: PD = CREATEFN(OutDir, PP, PPF); break; + case PD_##NAME: PD = CREATEFN(OutDir, PP); break; #include "clang/Frontend/Analyses.def" } } @@ -444,12 +440,11 @@ static void ActionInlineCall(AnalysisManager &mgr, Decl *D) { //===----------------------------------------------------------------------===// ASTConsumer* clang::CreateAnalysisConsumer(Diagnostic &diags, Preprocessor* pp, - PreprocessorFactory* ppf, const LangOptions& lopts, const std::string& OutDir, const AnalyzerOptions& Opts) { - llvm::OwningPtr<AnalysisConsumer> C(new AnalysisConsumer(diags, pp, ppf, + llvm::OwningPtr<AnalysisConsumer> C(new AnalysisConsumer(diags, pp, lopts, OutDir, Opts)); diff --git a/lib/Frontend/HTMLDiagnostics.cpp b/lib/Frontend/HTMLDiagnostics.cpp index 9d6f96c69f..648ecac3bf 100644 --- a/lib/Frontend/HTMLDiagnostics.cpp +++ b/lib/Frontend/HTMLDiagnostics.cpp @@ -77,7 +77,6 @@ HTMLDiagnostics::HTMLDiagnostics(const std::string& prefix, Preprocessor* pp, PathDiagnosticClient* clang::CreateHTMLDiagnosticClient(const std::string& prefix, Preprocessor* PP, - PreprocessorFactory*, llvm::SmallVectorImpl<std::string>* FilesMade) { return new HTMLDiagnostics(prefix, PP, FilesMade); @@ -111,8 +110,7 @@ public: PathDiagnosticClientFactory* clang::CreateHTMLDiagnosticClientFactory(const std::string& prefix, - Preprocessor* PP, - PreprocessorFactory*) { + Preprocessor* PP) { return new HTMLDiagnosticsFactory(prefix, PP); } @@ -216,12 +214,6 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D) { // for example. if (PP) html::SyntaxHighlight(R, FID, *PP); - - // FIXME: We eventually want to use PPF to create a fresh Preprocessor, - // once we have worked out the bugs. - // - // if (PPF) html::HighlightMacros(R, FID, *PPF); - // if (PP) html::HighlightMacros(R, FID, *PP); // Get the full directory name of the analyzed file. diff --git a/lib/Frontend/HTMLPrint.cpp b/lib/Frontend/HTMLPrint.cpp index 8d93d70e83..75e6184572 100644 --- a/lib/Frontend/HTMLPrint.cpp +++ b/lib/Frontend/HTMLPrint.cpp @@ -13,13 +13,14 @@ #include "clang/Frontend/ASTConsumers.h" #include "clang/AST/ASTConsumer.h" +#include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" -#include "clang/Rewrite/Rewriter.h" -#include "clang/Rewrite/HTMLRewrite.h" #include "clang/Basic/Diagnostic.h" -#include "clang/Basic/SourceManager.h" #include "clang/Basic/FileManager.h" -#include "clang/AST/ASTContext.h" +#include "clang/Basic/SourceManager.h" +#include "clang/Lex/Preprocessor.h" +#include "clang/Rewrite/HTMLRewrite.h" +#include "clang/Rewrite/Rewriter.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" using namespace clang; @@ -32,13 +33,14 @@ namespace { class HTMLPrinter : public ASTConsumer { Rewriter R; llvm::raw_ostream *Out; - Diagnostic &Diags; - Preprocessor *PP; - PreprocessorFactory *PPF; + Preprocessor &PP; + bool SyntaxHighlight, HighlightMacros; + public: - HTMLPrinter(llvm::raw_ostream *OS, Diagnostic &D, Preprocessor *pp, - PreprocessorFactory* ppf) - : Out(OS), Diags(D), PP(pp), PPF(ppf) {} + HTMLPrinter(llvm::raw_ostream *OS, Preprocessor &pp, + bool _SyntaxHighlight, bool _HighlightMacros) + : Out(OS), PP(pp), SyntaxHighlight(_SyntaxHighlight), + HighlightMacros(_HighlightMacros) {} virtual ~HTMLPrinter(); void Initialize(ASTContext &context); @@ -46,10 +48,10 @@ namespace { } ASTConsumer* clang::CreateHTMLPrinter(llvm::raw_ostream *OS, - Diagnostic &D, Preprocessor *PP, - PreprocessorFactory* PPF) { - - return new HTMLPrinter(OS, D, PP, PPF); + Preprocessor &PP, + bool SyntaxHighlight, + bool HighlightMacros) { + return new HTMLPrinter(OS, PP, SyntaxHighlight, HighlightMacros); } void HTMLPrinter::Initialize(ASTContext &context) { @@ -57,7 +59,7 @@ void HTMLPrinter::Initialize(ASTContext &context) { } HTMLPrinter::~HTMLPrinter() { - if (Diags.hasErrorOccurred()) + if (PP.getDiagnostics().hasErrorOccurred()) return; // Format the file. @@ -79,8 +81,8 @@ HTMLPrinter::~HTMLPrinter() { // We might not have a preprocessor if we come from a deserialized AST file, // for example. - if (PP) html::SyntaxHighlight(R, FID, *PP); - if (PPF) html::HighlightMacros(R, FID, *PP); + if (SyntaxHighlight) html::SyntaxHighlight(R, FID, PP); + if (HighlightMacros) html::HighlightMacros(R, FID, PP); html::EscapeText(R, FID, false, true); // Emit the HTML. diff --git a/lib/Frontend/PlistDiagnostics.cpp b/lib/Frontend/PlistDiagnostics.cpp index a83dca0a5f..a10ecd4a20 100644 --- a/lib/Frontend/PlistDiagnostics.cpp +++ b/lib/Frontend/PlistDiagnostics.cpp @@ -29,7 +29,6 @@ typedef llvm::DenseMap<FileID, unsigned> FIDMap; namespace clang { class Preprocessor; - class PreprocessorFactory; } namespace { @@ -63,8 +62,7 @@ PlistDiagnostics::PlistDiagnostics(const std::string& output, } PathDiagnosticClient* -clang::CreatePlistDiagnosticClient(const std::string& s, - Preprocessor *PP, PreprocessorFactory*, +clang::CreatePlistDiagnosticClient(const std::string& s, Preprocessor *PP, PathDiagnosticClientFactory *PF) { return new PlistDiagnostics(s, PP->getLangOptions(), PF); } |