Coverage Report

Created: 2022-07-16 07:03

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Tooling/ASTDiff/ASTDiffInternal.h
Line
Count
Source (jump to first uncovered line)
1
//===- ASTDiffInternal.h --------------------------------------*- C++ -*- -===//
2
//
3
//
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
// See https://llvm.org/LICENSE.txt for license information.
6
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
11
#define LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
12
13
#include "clang/AST/ASTTypeTraits.h"
14
15
namespace clang {
16
namespace diff {
17
18
using DynTypedNode = DynTypedNode;
19
20
/// Within a tree, this identifies a node by its preorder offset.
21
struct NodeId {
22
private:
23
  static constexpr int InvalidNodeId = -1;
24
25
public:
26
  int Id;
27
28
4.91k
  NodeId() : Id(InvalidNodeId) {}
29
2.92k
  NodeId(int Id) : Id(Id) {}
30
31
64.8k
  operator int() const { return Id; }
32
1.78k
  NodeId &operator++() { return ++Id, *this; }
33
0
  NodeId &operator--() { return --Id, *this; }
34
  // Support defining iterators on NodeId.
35
1.56k
  NodeId &operator*() { return *this; }
36
37
4.75k
  bool isValid() const { return Id != InvalidNodeId; }
38
2.87k
  bool isInvalid() const { return Id == InvalidNodeId; }
39
};
40
41
} // end namespace diff
42
} // end namespace clang
43
#endif