/src/CMake/Source/cmMessenger.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 <iosfwd> |
8 | | #include <memory> |
9 | | #include <string> |
10 | | |
11 | | #include <cm/optional> |
12 | | |
13 | | #include "cmDiagnostics.h" |
14 | | #include "cmListFileCache.h" |
15 | | #include "cmMessageType.h" // IWYU pragma: keep |
16 | | |
17 | | #ifndef CMAKE_BOOTSTRAP |
18 | | # include "cmSarifLog.h" |
19 | | #endif |
20 | | |
21 | | class cmStateSnapshot; |
22 | | |
23 | | #ifdef CMake_ENABLE_DEBUGGER |
24 | | namespace cmDebugger { |
25 | | class cmDebuggerAdapter; |
26 | | } |
27 | | #endif |
28 | | |
29 | | class cmMessenger |
30 | | { |
31 | | public: |
32 | | void IssueMessage( |
33 | | MessageType type, std::string const& text, |
34 | | cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; |
35 | | |
36 | | void IssueDiagnostic( |
37 | | cmDiagnosticCategory category, std::string const& text, |
38 | | cmStateSnapshot const& context, |
39 | | cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const; |
40 | | |
41 | | void DisplayMessage(MessageType type, cmDiagnosticCategory category, |
42 | | std::string const& text, |
43 | | cmListFileBacktrace const& backtrace) const; |
44 | | |
45 | | void SetTopSource(cm::optional<std::string> topSource); |
46 | | |
47 | | #ifndef CMAKE_BOOTSTRAP |
48 | 1 | cmSarif::ResultsLog const& GetSarifResultsLog() const { return SarifLog; } |
49 | | #endif |
50 | | |
51 | | // Print the top of a backtrace. |
52 | | void PrintBacktraceTitle(std::ostream& out, |
53 | | cmListFileBacktrace const& bt) const; |
54 | | #ifdef CMake_ENABLE_DEBUGGER |
55 | | void SetDebuggerAdapter( |
56 | | std::shared_ptr<cmDebugger::cmDebuggerAdapter> const& debuggerAdapter) |
57 | 0 | { |
58 | 0 | DebuggerAdapter = debuggerAdapter; |
59 | 0 | } |
60 | | #endif |
61 | | |
62 | | private: |
63 | | cm::optional<std::string> TopSource; |
64 | | |
65 | | #ifndef CMAKE_BOOTSTRAP |
66 | | cmSarif::ResultsLog SarifLog; |
67 | | #endif |
68 | | |
69 | | #ifdef CMake_ENABLE_DEBUGGER |
70 | | std::shared_ptr<cmDebugger::cmDebuggerAdapter> DebuggerAdapter; |
71 | | #endif |
72 | | }; |