1 | //===- DeclOccurrence.h - An occurrence of a decl within a file -*- C++ -*-===// |
---|---|
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_CLANG_INDEX_DECLOCCURRENCE_H |
10 | #define LLVM_CLANG_INDEX_DECLOCCURRENCE_H |
11 | |
12 | #include "clang/Basic/LLVM.h" |
13 | #include "clang/Index/IndexSymbol.h" |
14 | #include "llvm/ADT/ArrayRef.h" |
15 | #include "llvm/ADT/SmallVector.h" |
16 | |
17 | namespace clang { |
18 | class Decl; |
19 | |
20 | namespace index { |
21 | |
22 | struct DeclOccurrence { |
23 | SymbolRoleSet Roles; |
24 | unsigned Offset; |
25 | const Decl *Dcl; |
26 | SmallVector<SymbolRelation, 3> Relations; |
27 | |
28 | DeclOccurrence(SymbolRoleSet R, unsigned Offset, const Decl *D, |
29 | ArrayRef<SymbolRelation> Relations) |
30 | : Roles(R), Offset(Offset), Dcl(D), |
31 | Relations(Relations.begin(), Relations.end()) {} |
32 | |
33 | friend bool operator<(const DeclOccurrence &LHS, const DeclOccurrence &RHS) { |
34 | return LHS.Offset < RHS.Offset; |
35 | } |
36 | }; |
37 | |
38 | } // namespace index |
39 | } // namespace clang |
40 | |
41 | #endif // LLVM_CLANG_INDEX_DECLOCCURRENCE_H |
42 |