Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 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
/// 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