Coverage Report

Created: 2020-02-15 09:57

/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
class SyntaxTree;
21
class SyntaxTreeImpl;
22
struct ComparisonOptions;
23
24
/// Within a tree, this identifies a node by its preorder offset.
25
struct NodeId {
26
private:
27
  static constexpr int InvalidNodeId = -1;
28
29
public:
30
  int Id;
31
32
4.91k
  NodeId() : Id(InvalidNodeId) {}
33
2.92k
  NodeId(int Id) : Id(Id) {}
34
35
65.1k
  operator int() const { return Id; }
36
1.78k
  NodeId &operator++() { return ++Id, *this; }
37
0
  NodeId &operator--() { return --Id, *this; }
38
  // Support defining iterators on NodeId.
39
1.56k
  NodeId &operator*() { return *this; }
40
41
4.75k
  bool isValid() const { return Id != InvalidNodeId; }
42
2.87k
  bool isInvalid() const { return Id == InvalidNodeId; }
43
};
44
45
} // end namespace diff
46
} // end namespace clang
47
#endif