class TextDiagnosticPrinter

Declaration

class TextDiagnosticPrinter : public DiagnosticConsumer { /* full declaration omitted */ };

Description

Abstract interface, implemented by clients of the front-end, which formats and prints fully processed diagnostics.

Declared at: clang/include/clang/Frontend/TextDiagnosticPrinter.h:27

Inherits from: DiagnosticConsumer

Member Variables

private llvm::raw_ostream& OS
private IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts
private std::unique_ptr<TextDiagnostic> TextDiag
Handle to the currently active text diagnostic emitter.
private std::string Prefix
A string to prefix to error messages.
private unsigned int OwnsOutputStream

Inherited from DiagnosticConsumer:

protected NumWarnings = 0
protected NumErrors = 0

Method Overview

Inherited from DiagnosticConsumer:

Methods

void BeginSourceFile(
    const clang::LangOptions& LO,
    const clang::Preprocessor* PP)

Description

Callback to inform the diagnostic client that processing of a source file is beginning. Note that diagnostics may be emitted outside the processing of a source file, for example during the parsing of command line options. However, diagnostics with source range information are required to only be emitted in between BeginSourceFile() and EndSourceFile().

Declared at: clang/include/clang/Frontend/TextDiagnosticPrinter.h:49

Parameters

const clang::LangOptions& LO
const clang::Preprocessor* PP
The preprocessor object being used for the source; this is optional, e.g., it may not be present when processing AST source files.

void EndSourceFile()

Description

Callback to inform the diagnostic client that processing of a source file has ended. The diagnostic client should assume that any objects made available via BeginSourceFile() are inaccessible.

Declared at: clang/include/clang/Frontend/TextDiagnosticPrinter.h:50

void HandleDiagnostic(
    DiagnosticsEngine::Level Level,
    const clang::Diagnostic& Info)

Description

Handle this diagnostic, reporting it to the user or capturing it to a log as needed. The default implementation just keeps track of the total number of warnings and errors.

Declared at: clang/include/clang/Frontend/TextDiagnosticPrinter.h:51

Parameters

DiagnosticsEngine::Level Level
const clang::Diagnostic& Info

TextDiagnosticPrinter(
    llvm::raw_ostream& os,
    clang::DiagnosticOptions* diags,
    bool OwnsOutputStream = false)

Declared at: clang/include/clang/Frontend/TextDiagnosticPrinter.h:40

Parameters

llvm::raw_ostream& os
clang::DiagnosticOptions* diags
bool OwnsOutputStream = false

void setPrefix(std::string Value)

Description

setPrefix - Set the diagnostic printer prefix string, which will be printed at the start of any diagnostics. If empty, no prefix string is used.

Declared at: clang/include/clang/Frontend/TextDiagnosticPrinter.h:47

Parameters

std::string Value

~TextDiagnosticPrinter()

Declared at: clang/include/clang/Frontend/TextDiagnosticPrinter.h:42