clang 20.0.0git
TextDiagnosticBuffer.h
Go to the documentation of this file.
1//===- TextDiagnosticBuffer.h - Buffer Text Diagnostics ---------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is a concrete diagnostic client, which buffers the diagnostic messages.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICBUFFER_H
14#define LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICBUFFER_H
15
18#include <cstddef>
19#include <string>
20#include <utility>
21#include <vector>
22
23namespace clang {
24
26public:
27 using DiagList = std::vector<std::pair<SourceLocation, std::string>>;
28 using iterator = DiagList::iterator;
29 using const_iterator = DiagList::const_iterator;
30
31private:
32 DiagList Errors, Warnings, Remarks, Notes;
33
34 /// All - All diagnostics in the order in which they were generated. That
35 /// order likely doesn't correspond to user input order, but it at least
36 /// keeps notes in the right places. Each pair in the vector is a diagnostic
37 /// level and an index into the corresponding DiagList above.
38 std::vector<std::pair<DiagnosticsEngine::Level, size_t>> All;
39
40public:
41 const_iterator err_begin() const { return Errors.begin(); }
42 const_iterator err_end() const { return Errors.end(); }
43
44 const_iterator warn_begin() const { return Warnings.begin(); }
45 const_iterator warn_end() const { return Warnings.end(); }
46
47 const_iterator remark_begin() const { return Remarks.begin(); }
48 const_iterator remark_end() const { return Remarks.end(); }
49
50 const_iterator note_begin() const { return Notes.begin(); }
51 const_iterator note_end() const { return Notes.end(); }
52
54 const Diagnostic &Info) override;
55
56 /// FlushDiagnostics - Flush the buffered diagnostics to an given
57 /// diagnostic engine.
58 void FlushDiagnostics(DiagnosticsEngine &Diags) const;
59};
60
61} // namespace clang
62
63#endif // LLVM_CLANG_FRONTEND_TEXTDIAGNOSTICBUFFER_H
Defines the Diagnostic-related interfaces.
Defines the clang::SourceLocation class and associated facilities.
Abstract interface, implemented by clients of the front-end, which formats and prints fully processed...
Definition: Diagnostic.h:1745
A little helper class (which is basically a smart pointer that forwards info from DiagnosticsEngine) ...
Definition: Diagnostic.h:1571
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
Level
The level of the diagnostic, after it has been through mapping.
Definition: Diagnostic.h:195
void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) override
HandleDiagnostic - Store the errors, warnings, and notes that are reported.
DiagList::const_iterator const_iterator
std::vector< std::pair< SourceLocation, std::string > > DiagList
const_iterator warn_end() const
const_iterator note_begin() const
const_iterator err_begin() const
void FlushDiagnostics(DiagnosticsEngine &Diags) const
FlushDiagnostics - Flush the buffered diagnostics to an given diagnostic engine.
const_iterator note_end() const
const_iterator warn_begin() const
const_iterator remark_begin() const
const_iterator remark_end() const
const_iterator err_end() const
The JSON file list parser is used to communicate input to InstallAPI.