1 //===- ASTDiffInternal.h --------------------------------------*- C++ -*- -===//
4 // The LLVM Compiler Infrastructure
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 #ifndef LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
12 #define LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
14 #include "clang/AST/ASTTypeTraits.h"
19 using DynTypedNode = ast_type_traits::DynTypedNode;
23 struct ComparisonOptions;
25 /// Within a tree, this identifies a node by its preorder offset.
28 static constexpr int InvalidNodeId = -1;
33 NodeId() : Id(InvalidNodeId) {}
34 NodeId(int Id) : Id(Id) {}
36 operator int() const { return Id; }
37 NodeId &operator++() { return ++Id, *this; }
38 NodeId &operator--() { return --Id, *this; }
39 // Support defining iterators on NodeId.
40 NodeId &operator*() { return *this; }
42 bool isValid() const { return Id != InvalidNodeId; }
43 bool isInvalid() const { return Id == InvalidNodeId; }
46 } // end namespace diff
47 } // end namespace clang