clang 8.0.0

ASTDiffInternal.h
Go to the documentation of this file.
1 //===- ASTDiffInternal.h --------------------------------------*- C++ -*- -===//
2 //
3 //
4 // The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #ifndef LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
12 #define LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
13
14 #include "clang/AST/ASTTypeTraits.h"
15
16 namespace clang {
17 namespace diff {
18
19 using DynTypedNode = ast_type_traits::DynTypedNode;
20
21 class SyntaxTree;
22 class SyntaxTreeImpl;
23 struct ComparisonOptions;
24
25 /// Within a tree, this identifies a node by its preorder offset.
26 struct NodeId {
27 private:
28 static constexpr int InvalidNodeId = -1;
29
30 public:
31 int Id;
32
33 NodeId() : Id(InvalidNodeId) {}
34 NodeId(int Id) : Id(Id) {}
35
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; }
41
42 bool isValid() const { return Id != InvalidNodeId; }
43 bool isInvalid() const { return Id == InvalidNodeId; }
44 };
45
46 } // end namespace diff
47 } // end namespace clang
48 #endif
clang::diff::NodeId::operator*
NodeId & operator*()
Definition: ASTDiffInternal.h:40
clang::diff::NodeId::isValid
bool isValid() const
Definition: ASTDiffInternal.h:42
clang::diff::NodeId
Within a tree, this identifies a node by its preorder offset.
Definition: ASTDiffInternal.h:26
clang::diff::NodeId::NodeId
NodeId()
Definition: ASTDiffInternal.h:33
ASTTypeTraits.h
clang::diff::NodeId::NodeId
NodeId(int Id)
Definition: ASTDiffInternal.h:34
clang::diff::NodeId::operator++
NodeId & operator++()
Definition: ASTDiffInternal.h:37
clang::diff::ComparisonOptions
Definition: ASTDiff.h:104
clang::diff::SyntaxTree
SyntaxTree objects represent subtrees of the AST.
Definition: ASTDiff.h:68
clang::diff::DynTypedNode
ast_type_traits::DynTypedNode DynTypedNode
Definition: ASTDiffInternal.h:19
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::diff::NodeId::operator--
NodeId & operator--()
Definition: ASTDiffInternal.h:38
clang::ast_type_traits::DynTypedNode
A dynamically typed AST node container.
Definition: ASTTypeTraits.h:212
clang::diff::NodeId::Id
int Id
Definition: ASTDiffInternal.h:31
clang::diff::NodeId::isInvalid
bool isInvalid() const
Definition: ASTDiffInternal.h:43