Coverage Report

Created: 2026-02-09 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Source/cmTargetDepend.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 <set>
8
9
#include "cmListFileCache.h"
10
11
class cmGeneratorTarget;
12
13
/** One edge in the global target dependency graph.
14
    It may be marked as a 'link' or 'util' edge or both.  */
15
class cmTargetDepend
16
{
17
  cmGeneratorTarget const* Target;
18
19
  // The set order depends only on the Target, so we use
20
  // mutable members to achieve a map with set syntax.
21
  mutable bool Link = false;
22
  mutable bool Util = false;
23
  mutable bool Cross = false;
24
  mutable cmListFileBacktrace Backtrace;
25
26
public:
27
  cmTargetDepend(cmGeneratorTarget const* t)
28
0
    : Target(t)
29
0
  {
30
0
  }
31
0
  operator cmGeneratorTarget const*() const { return this->Target; }
32
0
  cmGeneratorTarget const* operator->() const { return this->Target; }
33
0
  cmGeneratorTarget const& operator*() const { return *this->Target; }
34
  friend bool operator<(cmTargetDepend const& l, cmTargetDepend const& r)
35
0
  {
36
0
    return l.Target < r.Target;
37
0
  }
38
  void SetType(bool strong) const
39
0
  {
40
0
    if (strong) {
41
0
      this->Util = true;
42
0
    } else {
43
0
      this->Link = true;
44
0
    }
45
0
  }
46
0
  void SetCross(bool cross) const { this->Cross = cross; }
47
  void SetBacktrace(cmListFileBacktrace const& bt) const
48
0
  {
49
0
    this->Backtrace = bt;
50
0
  }
51
0
  bool IsLink() const { return this->Link; }
52
0
  bool IsUtil() const { return this->Util; }
53
0
  bool IsCross() const { return this->Cross; }
54
0
  cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
55
};
56
57
/** Unordered set of (direct) dependencies of a target. */
58
class cmTargetDependSet : public std::set<cmTargetDepend>
59
{
60
};