0.6.3
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Attributes | List of all members
clanguml::generators::diagnostic_consumer Class Reference

Detailed Description

Definition at line 51 of file clang_tool.h.

#include <clang_tool.h>

Public Member Functions

 diagnostic_consumer (std::filesystem::path relative_to)
 
void HandleDiagnostic (DiagnosticsEngine::Level diag_level, const Diagnostic &info) override
 

Public Attributes

bool failed {false}
 
std::vector< diagnosticdiagnostics
 

Private Attributes

std::filesystem::path relative_to_
 

Constructor & Destructor Documentation

◆ diagnostic_consumer()

clanguml::generators::diagnostic_consumer::diagnostic_consumer ( std::filesystem::path  relative_to)

Definition at line 87 of file clang_tool.cc.

88 : relative_to_{std::move(relative_to)}
89{
90}

Member Function Documentation

◆ HandleDiagnostic()

void clanguml::generators::diagnostic_consumer::HandleDiagnostic ( DiagnosticsEngine::Level  diag_level,
const Diagnostic &  info 
)
override

Definition at line 92 of file clang_tool.cc.

94{
95 SmallVector<char> buf{};
96 info.FormatDiagnostic(buf);
97
98 diagnostic d;
99 d.level = diag_level;
100 d.description = std::string{buf.data(), buf.size()};
101
102 if (info.hasSourceManager() && info.getLocation().isValid()) {
104 common::set_source_location(info.getSourceManager(), info.getLocation(),
105 *d.location, {}, relative_to_);
106 }
107
108 if (diag_level == clang::DiagnosticsEngine::Level::Error ||
109 diag_level == clang::DiagnosticsEngine::Level::Fatal) {
110 failed = true;
111 }
112
113 diagnostics.emplace_back(std::move(d));
114}

Member Data Documentation

◆ diagnostics

std::vector<diagnostic> clanguml::generators::diagnostic_consumer::diagnostics

List of all diagnostics collected for a given TU

Definition at line 62 of file clang_tool.h.

◆ failed

bool clanguml::generators::diagnostic_consumer::failed {false}

If true, at least one of the diagnostics represents an error

Definition at line 59 of file clang_tool.h.

◆ relative_to_

std::filesystem::path clanguml::generators::diagnostic_consumer::relative_to_
private

Definition at line 65 of file clang_tool.h.


The documentation for this class was generated from the following files: