aboutsummaryrefslogtreecommitdiff
path: root/Driver/HTMLPrint.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-17 22:31:54 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-17 22:31:54 +0000
commit339b9c27759d7b6a53e2370f83f66e78b3254595 (patch)
tree15e66daac43c681523a05a5df269e2a6d9f19c8d /Driver/HTMLPrint.cpp
parent1ee8d6ffabdec9288dbc87773913fde5e2938772 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/HTMLPrint.cpp')
-rw-r--r--Driver/HTMLPrint.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/Driver/HTMLPrint.cpp b/Driver/HTMLPrint.cpp
index ff04b0e609..ba9cd9e400 100644
--- a/Driver/HTMLPrint.cpp
+++ b/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 == "-")