clang  19.0.0git
ASTDiffInternal.h
Go to the documentation of this file.
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 
14 
15 namespace clang {
16 namespace diff {
17 
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  NodeId() : Id(InvalidNodeId) {}
29  NodeId(int Id) : Id(Id) {}
30 
31  operator int() const { return Id; }
32  NodeId &operator++() { return ++Id, *this; }
33  NodeId &operator--() { return --Id, *this; }
34  // Support defining iterators on NodeId.
35  NodeId &operator*() { return *this; }
36 
37  bool isValid() const { return Id != InvalidNodeId; }
38  bool isInvalid() const { return Id == InvalidNodeId; }
39 };
40 
41 } // end namespace diff
42 } // end namespace clang
43 #endif
__device__ int
DynTypedNode DynTypedNode
The JSON file list parser is used to communicate input to InstallAPI.
Within a tree, this identifies a node by its preorder offset.
bool isValid() const
bool isInvalid() const