File indexing completed on 2026-05-10 08:36:56
0001
0002
0003
0004
0005
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 }
0043 }
0044
0045 #endif