1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
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 = ast_type_traits::DynTypedNode; |
19 | |
20 | class SyntaxTree; |
21 | class SyntaxTreeImpl; |
22 | struct ComparisonOptions; |
23 | |
24 | |
25 | struct NodeId { |
26 | private: |
27 | static constexpr int InvalidNodeId = -1; |
28 | |
29 | public: |
30 | int Id; |
31 | |
32 | NodeId() : Id(InvalidNodeId) {} |
33 | NodeId(int Id) : Id(Id) {} |
34 | |
35 | operator int() const { return Id; } |
36 | NodeId &operator++() { return ++Id, *this; } |
37 | NodeId &operator--() { return --Id, *this; } |
38 | |
39 | NodeId &operator*() { return *this; } |
40 | |
41 | bool isValid() const { return Id != InvalidNodeId; } |
42 | bool isInvalid() const { return Id == InvalidNodeId; } |
43 | }; |
44 | |
45 | } |
46 | } |
47 | #endif |
48 | |