class LogDiagnosticPrinter

Declaration

class LogDiagnosticPrinter : 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/LogDiagnosticPrinter.h:21

Inherits from: DiagnosticConsumer

Member Variables

private llvm::raw_ostream& OS
private std::unique_ptr<raw_ostream> StreamOwner
private const clang::LangOptions* LangOpts
private IntrusiveRefCntPtr<clang::DiagnosticOptions> DiagOpts
private clang::SourceLocation LastWarningLoc
private clang::FullSourceLoc LastLoc
private SmallVector< clang::LogDiagnosticPrinter::DiagEntry, 8> Entries
private std::string MainFilename
private std::string DwarfDebugFlags

Inherited from DiagnosticConsumer:

protected NumWarnings = 0
protected NumErrors = 0

Method Overview

  • public void BeginSourceFile(const clang::LangOptions & LO, const clang::Preprocessor * PP)
  • private void EmitDiagEntry(llvm::raw_ostream & OS, const LogDiagnosticPrinter::DiagEntry & DE)
  • public void EndSourceFile()
  • public void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic & Info)
  • public LogDiagnosticPrinter(llvm::raw_ostream & OS, clang::DiagnosticOptions * Diags, std::unique_ptr<raw_ostream> StreamOwner)
  • public void setDwarfDebugFlags(llvm::StringRef Value)

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/LogDiagnosticPrinter.h:72

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 EmitDiagEntry(
    llvm::raw_ostream& OS,
    const LogDiagnosticPrinter::DiagEntry& DE)

Declared at: clang/include/clang/Frontend/LogDiagnosticPrinter.h:45

Parameters

llvm::raw_ostream& OS
const LogDiagnosticPrinter::DiagEntry& DE

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/LogDiagnosticPrinter.h:76

void HandleDiagnostic(
    DiagnosticsEngine::Level DiagLevel,
    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/LogDiagnosticPrinter.h:78

Parameters

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

LogDiagnosticPrinter(
    llvm::raw_ostream& OS,
    clang::DiagnosticOptions* Diags,
    std::unique_ptr<raw_ostream> StreamOwner)

Declared at: clang/include/clang/Frontend/LogDiagnosticPrinter.h:65

Parameters

llvm::raw_ostream& OS
clang::DiagnosticOptions* Diags
std::unique_ptr<raw_ostream> StreamOwner

void setDwarfDebugFlags(llvm::StringRef Value)

Declared at: clang/include/clang/Frontend/LogDiagnosticPrinter.h:68

Parameters

llvm::StringRef Value