clang 19.0.0git
DeclOccurrence.h
Go to the documentation of this file.
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/AST/DeclBase.h"
13#include "clang/Basic/LLVM.h"
15#include "clang/Lex/MacroInfo.h"
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/PointerUnion.h"
18#include "llvm/ADT/SmallVector.h"
19
20namespace clang {
21namespace index {
22
25 unsigned Offset;
26 llvm::PointerUnion<const Decl *, const MacroInfo *> DeclOrMacro;
27 const IdentifierInfo *MacroName = nullptr;
29
30 DeclOccurrence(SymbolRoleSet R, unsigned Offset, const Decl *D,
32 : Roles(R), Offset(Offset), DeclOrMacro(D),
33 Relations(Relations.begin(), Relations.end()) {}
35 const MacroInfo *MI)
36 : Roles(R), Offset(Offset), DeclOrMacro(MI), MacroName(Name) {}
37
38 friend bool operator<(const DeclOccurrence &LHS, const DeclOccurrence &RHS) {
39 return LHS.Offset < RHS.Offset;
40 }
41};
42
43} // namespace index
44} // namespace clang
45
46#endif // LLVM_CLANG_INDEX_DECLOCCURRENCE_H
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::MacroInfo and clang::MacroDirective classes.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:85
One of these records is kept for each identifier that is lexed.
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:39
The JSON file list parser is used to communicate input to InstallAPI.
llvm::PointerUnion< const Decl *, const MacroInfo * > DeclOrMacro
friend bool operator<(const DeclOccurrence &LHS, const DeclOccurrence &RHS)
DeclOccurrence(SymbolRoleSet R, unsigned Offset, const Decl *D, ArrayRef< SymbolRelation > Relations)
DeclOccurrence(SymbolRoleSet R, unsigned Offset, const IdentifierInfo *Name, const MacroInfo *MI)
SmallVector< SymbolRelation, 3 > Relations
const IdentifierInfo * MacroName