/src/CMake/Source/cmDiagnosticContext.h
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #pragma once |
4 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <utility> |
8 | | |
9 | | #include "cmDiagnostics.h" |
10 | | #include "cmListFileCache.h" |
11 | | |
12 | | class cmStateSnapshot; |
13 | | |
14 | | /** \class cmDiagnosticContext |
15 | | * \brief Records context for issuing diagnostics |
16 | | */ |
17 | | class cmDiagnosticContext |
18 | | { |
19 | | public: |
20 | | explicit cmDiagnosticContext(cmListFileBacktrace backtrace) |
21 | 0 | : Backtrace{ std::move(backtrace) } |
22 | 0 | { |
23 | 0 | } |
24 | 0 | cmDiagnosticContext() = default; |
25 | 0 | cmDiagnosticContext(cmDiagnosticContext&&) = default; |
26 | | cmDiagnosticContext(cmDiagnosticContext const&) = default; |
27 | | |
28 | | void RecordDiagnostic(cmDiagnosticCategory category, |
29 | | cmStateSnapshot const& state); |
30 | | |
31 | 0 | cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; } |
32 | | |
33 | | protected: |
34 | | friend class cmMessenger; |
35 | | |
36 | | cmListFileBacktrace Backtrace; |
37 | | cmDiagnostics::DiagnosticMap DiagnosticState; |
38 | | bool HasState = false; |
39 | | }; |