clang 20.0.0git
IndexingContext.cpp
Go to the documentation of this file.
1//===- IndexingContext.cpp - Indexing context data ------------------------===//
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#include "IndexingContext.h"
11#include "clang/AST/Attr.h"
12#include "clang/AST/DeclObjC.h"
17
18using namespace clang;
19using namespace index;
20
21static bool isGeneratedDecl(const Decl *D) {
22 if (auto *attr = D->getAttr<ExternalSourceSymbolAttr>()) {
23 return attr->getGeneratedDeclaration();
24 }
25 return false;
26}
27
29 return !isGeneratedDecl(D);
30}
31
33 return Ctx->getLangOpts();
34}
35
37 return IndexOpts.IndexFunctionLocals;
38}
39
41 return IndexOpts.IndexImplicitInstantiation;
42}
43
45 return IndexOpts.IndexParametersInDeclarations;
46}
47
49 return IndexOpts.IndexTemplateParameters;
50}
51
53 SymbolRoleSet Roles,
54 ArrayRef<SymbolRelation> Relations) {
55 return handleDecl(D, D->getLocation(), Roles, Relations);
56}
57
59 SymbolRoleSet Roles,
61 const DeclContext *DC) {
62 if (!DC)
63 DC = D->getDeclContext();
64
65 const Decl *OrigD = D;
66 if (isa<ObjCPropertyImplDecl>(D)) {
67 D = cast<ObjCPropertyImplDecl>(D)->getPropertyDecl();
68 }
69 return handleDeclOccurrence(D, Loc, /*IsRef=*/false, cast<Decl>(DC),
70 Roles, Relations,
71 nullptr, OrigD, DC);
72}
73
75 const NamedDecl *Parent,
76 const DeclContext *DC,
77 SymbolRoleSet Roles,
79 const Expr *RefE) {
81 return true;
82
84 (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
85 isa<TemplateTemplateParmDecl>(D))) {
86 return true;
87 }
88 return handleDeclOccurrence(