Coverage Report

Created: 2026-06-15 07:03

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/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 "cmDiagnosticContext.h"
14
#include "cmDiagnostics.h"
15
#include "cmListFileCache.h"
16
#include "cmMessageType.h" // IWYU pragma: keep
17
18
#ifndef CMAKE_BOOTSTRAP
19
#  include "cmSarifLog.h"
20
#endif
21
22
class cmStateSnapshot;
23
24
#ifdef CMake_ENABLE_DEBUGGER
25
namespace cmDebugger {
26
class cmDebuggerAdapter;
27
}
28
#endif
29
30
class cmMessenger
31
{
32
public:
33
  void IssueMessage(
34
    MessageType type, std::string const& text,
35
    cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
36
37
  void IssueDiagnostic(cmDiagnosticCategory category, std::string const& text,
38
                       cmStateSnapshot const& fallbackContext,
39
                       cmDiagnosticContext const& context = {}) 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
};