24 #include "llvm/Support/MemoryBuffer.h"
25 #include "llvm/Support/raw_ostream.h"
26 using namespace clang;
41 bool _SyntaxHighlight,
bool _HighlightMacros)
46 void HandleTranslationUnit(
ASTContext &Ctx)
override;
58 void HTMLPrinter::Initialize(
ASTContext &context) {
62 void HTMLPrinter::HandleTranslationUnit(
ASTContext &Ctx) {
63 if (PP.getDiagnostics().hasErrorOccurred())
67 FileID FID = R.getSourceMgr().getMainFileID();
68 const FileEntry* Entry = R.getSourceMgr().getFileEntryForID(FID);
76 Name = R.getSourceMgr().getBuffer(FID)->getBufferIdentifier();
91 char *Buffer = (
char*)malloc(RewriteBuf.
size());
92 std::copy(RewriteBuf.
begin(), RewriteBuf.
end(), Buffer);
Defines the clang::ASTContext interface.
Defines the clang::FileManager interface and associated types.
Defines the SourceManager interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void HighlightMacros(Rewriter &R, FileID FID, const Preprocessor &PP)
void AddLineNumbers(Rewriter &R, FileID FID)
const LangOptions & getLangOpts() const
void SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP)
Defines the clang::Preprocessor interface.
void AddHeaderFooterInternalBuiltinCSS(Rewriter &R, FileID FID, const char *title=nullptr)
const char * getName() const
void EscapeText(Rewriter &R, FileID FID, bool EscapeSpaces=false, bool ReplaceTabs=false)
Cached information about one file (either on disk or in the virtual file system). ...
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Defines the Diagnostic-related interfaces.
std::unique_ptr< ASTConsumer > CreateHTMLPrinter(raw_ostream *OS, Preprocessor &PP, bool SyntaxHighlight=true, bool HighlightMacros=true)
raw_ostream & write(raw_ostream &Stream) const
Write to Stream the result of applying all changes to the original buffer. Note that it isn't safe to...
SourceManager & getSourceManager()
Engages in a tight little dance with the lexer to efficiently preprocess tokens.