Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:10

0001 //===- ASTDiffInternal.h --------------------------------------*- C++ -*- -===//
0002 //
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
0011 #define LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFFINTERNAL_H
0012 
0013 #include "clang/AST/ASTTypeTraits.h"
0014 
0015 namespace clang {
0016 namespace diff {
0017 
0018 using DynTypedNode = DynTypedNode;
0019 
0020 /// Within a tree, this identifies a node by its preorder offset.
0021 struct NodeId {
0022 private:
0023   static constexpr int InvalidNodeId = -1;
0024 
0025 public:
0026   int Id;
0027 
0028   NodeId() : Id(InvalidNodeId) {}
0029   NodeId(int Id) : Id(Id) {}
0030 
0031   operator int() const { return Id; }
0032   NodeId &operator++() { return ++Id, *this; }
0033   NodeId &operator--() { return --Id, *this; }
0034   // Support defining iterators on NodeId.
0035   NodeId &operator*() { return *this; }
0036 
0037   bool isValid() const { return Id != InvalidNodeId; }
0038   bool isInvalid() const { return Id == InvalidNodeId; }
0039 };
0040 
0041 } // end namespace diff
0042 } // end namespace clang
0043 #endif