diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-17 22:31:54 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-17 22:31:54 +0000 |
commit | f42f3fb47d48429fb83198fbed07b8df9241e105 (patch) | |
tree | c96abd649a19c84ae16a9cf2863ca79d27c87049 /clang/Driver/HTMLPrint.cpp | |
parent | 7c7e9b3bbe74065f3a6e2c2e238c0b83442b5744 (diff) | |
download | bcm5719-llvm-f42f3fb47d48429fb83198fbed07b8df9241e105.tar.gz bcm5719-llvm-f42f3fb47d48429fb83198fbed07b8df9241e105.zip |
class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.
clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
passes it to the preprocessor object.
clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().
html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.
class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.
llvm-svn: 49875
Diffstat (limited to 'clang/Driver/HTMLPrint.cpp')
-rw-r--r-- | clang/Driver/HTMLPrint.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/clang/Driver/HTMLPrint.cpp b/clang/Driver/HTMLPrint.cpp index ff04b0e6097..ba9cd9e4002 100644 --- a/clang/Driver/HTMLPrint.cpp +++ b/clang/Driver/HTMLPrint.cpp @@ -31,9 +31,11 @@ namespace { std::string OutFilename; Diagnostic &Diags; Preprocessor *PP; + PreprocessorFactory *PPF; public: - HTMLPrinter(const std::string &OutFile, Diagnostic &D, Preprocessor *pp) - : OutFilename(OutFile), Diags(D), PP(pp) {} + HTMLPrinter(const std::string &OutFile, Diagnostic &D, Preprocessor *pp, + PreprocessorFactory* ppf) + : OutFilename(OutFile), Diags(D), PP(pp), PPF(ppf) {} virtual ~HTMLPrinter(); void Initialize(ASTContext &context); @@ -41,8 +43,10 @@ namespace { } ASTConsumer* clang::CreateHTMLPrinter(const std::string &OutFile, - Diagnostic &D, Preprocessor *PP) { - return new HTMLPrinter(OutFile, D, PP); + Diagnostic &D, Preprocessor *PP, + PreprocessorFactory* PPF) { + + return new HTMLPrinter(OutFile, D, PP, PPF); } void HTMLPrinter::Initialize(ASTContext &context) { @@ -62,13 +66,10 @@ HTMLPrinter::~HTMLPrinter() { // We might not have a preprocessor if we come from a deserialized AST file, // for example. - if (PP) { - html::SyntaxHighlight(R, FileID, *PP); - html::HighlightMacros(R, FileID, *PP); - } + if (PP) html::SyntaxHighlight(R, FileID, *PP); + if (PPF) html::HighlightMacros(R, FileID, *PPF); html::EscapeText(R, FileID, false, true); - // Open the output. FILE *OutputFILE; if (OutFilename.empty() || OutFilename == "-") |