Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:56

0001 //===- DeclOccurrence.h - An occurrence of a decl within a file -*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_INDEX_DECLOCCURRENCE_H
0010 #define LLVM_CLANG_INDEX_DECLOCCURRENCE_H
0011 
0012 #include "clang/AST/DeclBase.h"
0013 #include "clang/Basic/LLVM.h"
0014 #include "clang/Index/IndexSymbol.h"
0015 #include "clang/Lex/MacroInfo.h"
0016 #include "llvm/ADT/ArrayRef.h"
0017 #include "llvm/ADT/PointerUnion.h"
0018 #include "llvm/ADT/SmallVector.h"
0019 
0020 namespace clang {
0021 namespace index {
0022 
0023 struct DeclOccurrence {
0024   SymbolRoleSet Roles;
0025   unsigned Offset;
0026   llvm::PointerUnion<const Decl *, const MacroInfo *> DeclOrMacro;
0027   const IdentifierInfo *MacroName = nullptr;
0028   SmallVector<SymbolRelation, 3> Relations;
0029 
0030   DeclOccurrence(SymbolRoleSet R, unsigned Offset, const Decl *D,
0031                  ArrayRef<SymbolRelation> Relations)
0032       : Roles(R), Offset(Offset), DeclOrMacro(D), Relations(Relations) {}
0033   DeclOccurrence(SymbolRoleSet R, unsigned Offset, const IdentifierInfo *Name,
0034                  const MacroInfo *MI)
0035       : Roles(R), Offset(Offset), DeclOrMacro(MI), MacroName(Name) {}
0036 
0037   friend bool operator<(const DeclOccurrence &LHS, const DeclOccurrence &RHS) {
0038     return LHS.Offset < RHS.Offset;
0039   }
0040 };
0041 
0042 } // namespace index
0043 } // namespace clang
0044 
0045 #endif // LLVM_CLANG_INDEX_DECLOCCURRENCE_H