0.6.0
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 79 of file clang_tool.cc.

80 : relative_to_{std::move(relative_to)}
81{
82}

Member Function Documentation

◆ HandleDiagnostic()

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

Definition at line 84 of file clang_tool.cc.

86{
87 SmallVector<char> buf{};
88 info.FormatDiagnostic(buf);
89
90 diagnostic d;
91 d.level = diag_level;
92 d.description = std::string{buf.data(), buf.size()};
93
94 if (info.hasSourceManager() && info.getLocation().isValid()) {
96 common::set_source_location(info.getSourceManager(), info.getLocation(),
97 *d.location, {}, relative_to_);
98 }
99
100 if (diag_level == clang::DiagnosticsEngine::Level::Error ||
101 diag_level == clang::DiagnosticsEngine::Level::Fatal) {
102 failed = true;
103 }
104
105 diagnostics.emplace_back(std::move(d));
106}

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: