clang  14.0.0git
IndexSymbol.cpp
Go to the documentation of this file.
1 //===--- IndexSymbol.cpp - Types and functions for indexing symbols -------===//
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 
10 #include "clang/AST/Attr.h"
11 #include "clang/AST/DeclCXX.h"
12 #include "clang/AST/DeclObjC.h"
13 #include "clang/AST/DeclTemplate.h"
15 #include "clang/Lex/MacroInfo.h"
16 
17 using namespace clang;
18 using namespace clang::index;
19 
20 /// \returns true if \c D is a subclass of 'XCTestCase'.
21 static bool isUnitTestCase(const ObjCInterfaceDecl *D) {
22  if (!D)
23  return false;
24  while (const ObjCInterfaceDecl *SuperD = D->getSuperClass()) {
25  if (SuperD->getName() == "XCTestCase")
26  return true;
27  D = SuperD;
28  }
29  return false;
30 }
31 
32 /// \returns true if \c D is in a subclass of 'XCTestCase', returns void, has
33 /// no parameters, and its name starts with 'test'.
34 static bool isUnitTest(const ObjCMethodDecl *D) {
35  if (!D->parameters().empty())
36  return false;
37  if (!D->getReturnType()->isVoidType())
38  return false;
39  if (!D->getSelector().getNameForSlot(0).startswith("test"))
40  return false;
41  return isUnitTestCase(D->getClassInterface());
42 }
43 
44 static void checkForIBOutlets(const Decl *D, SymbolPropertySet &PropSet) {
45  if (D->hasAttr<IBOutletAttr>()) {
47  } else if (D->hasAttr<IBOutletCollectionAttr>()) {
50  }
51 }
52 
54  assert(D);
55 
56  if (isa<ParmVarDecl>(D))
57  return true;
58 
59  if (isa<ObjCTypeParamDecl>(D))
60  return true;
61 
62  if (isa<UsingDirectiveDecl>(D))
63  return false;
64  if (!D->getParentFunctionOrMethod())
65  return false;
66 
67  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
68  switch (ND->getFormalLinkage()) {
69  case NoLinkage:
70  case InternalLinkage:
71  return true;
72  case VisibleNoLinkage:
75  llvm_unreachable("Not a sema linkage");
76  case ModuleLinkage:
77  case ExternalLinkage:
78  return false;
79  }
80  }
81 
82  return true;
83 }
84 
86  assert(D);
87  SymbolInfo Info;
91  Info.Lang = SymbolLanguage::C;
92 
93  if (isFunctionLocalSymbol(D)) {
95  }
96  if (isa<ObjCProtocolDecl>(D->getDeclContext())) {
98  }
99 
100  if (auto *VT = dyn_cast<VarTemplateDecl>(D)) {
102  Info.Lang = SymbolLanguage::CXX;
103  // All other fields are filled from the templated decl.
104  D = VT->getTemplatedDecl();
105  }
106 
107  if (const TagDecl *TD = dyn_cast<TagDecl>(D)) {
108  switch (TD->getTagKind()) {
109  case TTK_Struct:
110  Info.Kind = SymbolKind::Struct; break;
111  case TTK_Union:
112  Info.Kind = SymbolKind::Union; break;
113  case TTK_Class:
114  Info.Kind = SymbolKind::Class;
115  Info.Lang = SymbolLanguage::CXX;
116  break;
117  case TTK_Interface:
118  Info.Kind = SymbolKind::Protocol;
119  Info.Lang = SymbolLanguage::CXX;
120  break;
121  case TTK_Enum:
122  Info.Kind = SymbolKind::Enum; break;
123  }
124 
125  if (const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D)) {
126  if (!CXXRec->isCLike()) {
127  Info.Lang = SymbolLanguage::CXX;
128  if (CXXRec->getDescribedClassTemplate()) {
130  }
131  }
132  }
133 
134  if (isa<ClassTemplatePartialSpecializationDecl>(D)) {
136  Info.Properties |=
138  } else if (isa<ClassTemplateSpecializationDecl>(D)) {
140  Info.Properties |=
142  }
143 
144  } else if (auto *VD = dyn_cast<VarDecl>(D)) {
145  Info.Kind = SymbolKind::Variable;
146  if (isa<ParmVarDecl>(D)) {
148  } else if (isa<CXXRecordDecl>(D->getDeclContext())) {
150  Info.Lang = SymbolLanguage::CXX;
151  }
152 
153  if (isa<VarTemplatePartialSpecializationDecl>(D)) {
154  Info.Lang = SymbolLanguage::CXX;
156  Info.Properties |=
158  } else if (isa<VarTemplateSpecializationDecl>(D)) {
159  Info.Lang = SymbolLanguage::CXX;
161  Info.Properties |=
163  } else if (VD->getDescribedVarTemplate()) {
164  Info.Lang = SymbolLanguage::CXX;
166  }
167 
168  } else {
169  switch (D->getKind()) {
170  case Decl::Import:
171  Info.Kind = SymbolKind::Module;
172  break;
173  case Decl::Typedef:
174  Info.Kind = SymbolKind::TypeAlias; break; // Lang = C
175  case Decl::Function:
176  Info.Kind = SymbolKind::Function;
177  break;
178  case Decl::Field:
179  case Decl::IndirectField:
180  Info.Kind = SymbolKind::Field;
181  if (const CXXRecordDecl *
182  CXXRec = dyn_cast<CXXRecordDecl>(D->getDeclContext())) {
183  if (!CXXRec->isCLike())
184  Info.Lang = SymbolLanguage::CXX;
185  }
186  break;
187  case Decl::EnumConstant:
188  Info.Kind = SymbolKind::EnumConstant; break;
189  case Decl::ObjCInterface:
190  case Decl::ObjCImplementation: {
191  Info.Kind = SymbolKind::Class;
192  Info.Lang = SymbolLanguage::ObjC;
193  const ObjCInterfaceDecl *ClsD = dyn_cast<ObjCInterfaceDecl>(D);
194  if (!ClsD)
195  ClsD = cast<ObjCImplementationDecl>(D)->getClassInterface();
196  if (isUnitTestCase(ClsD))
198  break;
199  }
200  case Decl::ObjCProtocol:
201  Info.Kind = SymbolKind::Protocol;
202  Info.Lang = SymbolLanguage::ObjC;
203  break;
204  case Decl::ObjCCategory:
205  case Decl::ObjCCategoryImpl: {
207  Info.Lang = SymbolLanguage::ObjC;
208  const ObjCInterfaceDecl *ClsD = nullptr;
209  if (auto *CatD = dyn_cast<ObjCCategoryDecl>(D))
210  ClsD = CatD->getClassInterface();
211  else
212  ClsD = cast<ObjCCategoryImplDecl>(D)->getClassInterface();
213  if (isUnitTestCase(ClsD))
215  break;
216  }
217  case Decl::ObjCMethod: {
218  const ObjCMethodDecl *MD = cast<ObjCMethodDecl>(D);
220  if (MD->isPropertyAccessor()) {
221  if (MD->param_size())
223  else
225  }
226  Info.Lang = SymbolLanguage::ObjC;
227  if (isUnitTest(MD))
229  if (D->hasAttr<IBActionAttr>())
231  break;
232  }
233  case Decl::ObjCProperty:
235  Info.Lang = SymbolLanguage::ObjC;
236  checkForIBOutlets(D, Info.Properties);
237  if (auto *Annot = D->getAttr<AnnotateAttr>()) {
238  if (Annot->getAnnotation() == "gk_inspectable")
240  }
241  break;
242  case Decl::ObjCIvar:
243  Info.Kind = SymbolKind::Field;
244  Info.Lang = SymbolLanguage::ObjC;
245  checkForIBOutlets(D, Info.Properties);
246  break;
247  case Decl::Namespace:
249  Info.Lang = SymbolLanguage::CXX;
250  break;
251  case Decl::NamespaceAlias:
253  Info.Lang = SymbolLanguage::CXX;
254  break;
255  case Decl::CXXConstructor: {
257  Info.Lang = SymbolLanguage::CXX;
258  auto *CD = cast<CXXConstructorDecl>(D);
259  if (CD->isCopyConstructor())
261  else if (CD->isMoveConstructor())
263  break;
264  }
265  case Decl::CXXDestructor:
267  Info.Lang = SymbolLanguage::CXX;
268  break;
269  case Decl::CXXConversion:
271  Info.Lang = SymbolLanguage::CXX;
272  break;
273  case Decl::CXXMethod: {
274  const CXXMethodDecl *MD = cast<CXXMethodDecl>(D);
275  if (MD->isStatic())
277  else
279  Info.Lang = SymbolLanguage::CXX;
280  break;
281  }
282  case Decl::ClassTemplate:
283  Info.Kind = SymbolKind::Class;
285  Info.Lang = SymbolLanguage::CXX;
286  break;
287  case Decl::FunctionTemplate:
288  Info.Kind = SymbolKind::Function;
290  Info.Lang = SymbolLanguage::CXX;
291  if (const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(
292  cast<FunctionTemplateDecl>(D)->getTemplatedDecl())) {
293  if (isa<CXXConstructorDecl>(MD))
295  else if (isa<CXXDestructorDecl>(MD))
297  else if (isa<CXXConversionDecl>(MD))
299  else {
300  if (MD->isStatic())
302  else
304  }
305  }
306  break;
307  case Decl::TypeAliasTemplate:
309  Info.Lang = SymbolLanguage::CXX;
311  break;
312  case Decl::TypeAlias:
314  Info.Lang = SymbolLanguage::CXX;
315  break;
316  case Decl::UnresolvedUsingTypename:
317  Info.Kind = SymbolKind::Using;
319  Info.Lang = SymbolLanguage::CXX;
321  break;
322  case Decl::UnresolvedUsingValue:
323  Info.Kind = SymbolKind::Using;
325  Info.Lang = SymbolLanguage::CXX;
327  break;
328  case Decl::Using:
329  Info.Kind = SymbolKind::Using;
330  Info.Lang = SymbolLanguage::CXX;
331  break;
332  case Decl::UsingEnum:
333  Info.Kind = SymbolKind::Using;
334  Info.Lang = SymbolLanguage::CXX;
336  break;
337  case Decl::Binding:
338  Info.Kind = SymbolKind::Variable;
339  Info.Lang = SymbolLanguage::CXX;
340  break;
341  case Decl::MSProperty:
343  if (const CXXRecordDecl *CXXRec =
344  dyn_cast<CXXRecordDecl>(D->getDeclContext())) {
345  if (!CXXRec->isCLike())
346  Info.Lang = SymbolLanguage::CXX;
347  }
348  break;
349  case Decl::ClassTemplatePartialSpecialization:
350  case Decl::ClassScopeFunctionSpecialization:
351  case Decl::ClassTemplateSpecialization:
352  case Decl::CXXRecord:
353  case Decl::Enum:
354  case Decl::Record:
355  llvm_unreachable("records handled before");
356  break;
357  case Decl::VarTemplateSpecialization:
358  case Decl::VarTemplatePartialSpecialization:
359  case Decl::ImplicitParam:
360  case Decl::ParmVar:
361  case Decl::Var:
362  case Decl::VarTemplate:
363  llvm_unreachable("variables handled before");
364  break;
365  case Decl::TemplateTypeParm:
367  break;
368  case Decl::TemplateTemplateParm:
370  break;
371  case Decl::NonTypeTemplateParm:
373  break;
374  // Other decls get the 'unknown' kind.
375  default:
376  break;
377  }
378  }
379 
380  if (Info.Kind == SymbolKind::Unknown)
381  return Info;
382 
383  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
384  if (FD->getTemplatedKind() ==
386  Info.Properties |= (SymbolPropertySet)SymbolProperty::Generic;
387  Info.Properties |=
389  }
390  }
391 
392  if (Info.Properties & (SymbolPropertySet)SymbolProperty::Generic)
393  Info.Lang = SymbolLanguage::CXX;
394 
395  if (auto *attr = D->getExternalSourceSymbolAttr()) {
396  if (attr->getLanguage() == "Swift")
397  Info.Lang = SymbolLanguage::Swift;
398  }
399 
400  return Info;
401 }
402 
404  SymbolInfo Info;
405  Info.Kind = SymbolKind::Macro;
407  Info.Properties = SymbolPropertySet();
408  Info.Lang = SymbolLanguage::C;
409  return Info;
410 }
411 
413  llvm::function_ref<bool(SymbolRole)> Fn) {
414 #define APPLY_FOR_ROLE(Role) \
415  if (Roles & (unsigned)SymbolRole::Role) \
416  if (!Fn(SymbolRole::Role)) \
417  return false;
418 
440 
441 #undef APPLY_FOR_ROLE
442 
443  return true;
444 }
445 
447  llvm::function_ref<void(SymbolRole)> Fn) {
448  applyForEachSymbolRoleInterruptible(Roles, [&](SymbolRole r) -> bool {
449  Fn(r);
450  return true;
451  });
452 }
453 
454 void index::printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS) {
455  bool VisitedOnce = false;
456  applyForEachSymbolRole(Roles, [&](SymbolRole Role) {
457  if (VisitedOnce)
458  OS << ',';
459  else
460  VisitedOnce = true;
461  switch (Role) {
462  case SymbolRole::Declaration: OS << "Decl"; break;
463  case SymbolRole::Definition: OS << "Def"; break;
464  case SymbolRole::Reference: OS << "Ref"; break;
465  case SymbolRole::Read: OS << "Read"; break;
466  case SymbolRole::Write: OS << "Writ"; break;
467  case SymbolRole::Call: OS << "Call"; break;
468  case SymbolRole::Dynamic: OS << "Dyn"; break;
469  case SymbolRole::AddressOf: OS << "Addr"; break;
470  case SymbolRole::Implicit: OS << "Impl"; break;
471  case SymbolRole::Undefinition: OS << "Undef"; break;
472  case SymbolRole::RelationChildOf: OS << "RelChild"; break;
473  case SymbolRole::RelationBaseOf: OS << "RelBase"; break;
474  case SymbolRole::RelationOverrideOf: OS << "RelOver"; break;
475  case SymbolRole::RelationReceivedBy: OS << "RelRec"; break;
476  case SymbolRole::RelationCalledBy: OS << "RelCall"; break;
477  case SymbolRole::RelationExtendedBy: OS << "RelExt"; break;
478  case SymbolRole::RelationAccessorOf: OS << "RelAcc"; break;
479  case SymbolRole::RelationContainedBy: OS << "RelCont"; break;
480  case SymbolRole::RelationIBTypeOf: OS << "RelIBType"; break;
481  case SymbolRole::RelationSpecializationOf: OS << "RelSpecialization"; break;
482  case SymbolRole::NameReference: OS << "NameReference"; break;
483  }
484  });
485 }
486 
487 bool index::printSymbolName(const Decl *D, const LangOptions &LO,
488  raw_ostream &OS) {
489  if (auto *ND = dyn_cast<NamedDecl>(D)) {
490  PrintingPolicy Policy(LO);
491  // Forward references can have different template argument names. Suppress
492  // the template argument names in constructors to make their name more
493  // stable.
495  DeclarationName DeclName = ND->getDeclName();
496  if (DeclName.isEmpty())
497  return true;
498  DeclName.print(OS, Policy);
499  return false;
500  } else {
501  return true;
502  }
503 }
504 
506  switch (K) {
507  case SymbolKind::Unknown: return "<unknown>";
508  case SymbolKind::Module: return "module";
509  case SymbolKind::Namespace: return "namespace";
510  case SymbolKind::NamespaceAlias: return "namespace-alias";
511  case SymbolKind::Macro: return "macro";
512  case SymbolKind::Enum: return "enum";
513  case SymbolKind::Struct: return "struct";
514  case SymbolKind::Class: return "class";
515  case SymbolKind::Protocol: return "protocol";
516  case SymbolKind::Extension: return "extension";
517  case SymbolKind::Union: return "union";
518  case SymbolKind::TypeAlias: return "type-alias";
519  case SymbolKind::Function: return "function";
520  case SymbolKind::Variable: return "variable";
521  case SymbolKind::Field: return "field";
522  case SymbolKind::EnumConstant: return "enumerator";
523  case SymbolKind::InstanceMethod: return "instance-method";
524  case SymbolKind::ClassMethod: return "class-method";
525  case SymbolKind::StaticMethod: return "static-method";
526  case SymbolKind::InstanceProperty: return "instance-property";
527  case SymbolKind::ClassProperty: return "class-property";
528  case SymbolKind::StaticProperty: return "static-property";
529  case SymbolKind::Constructor: return "constructor";
530  case SymbolKind::Destructor: return "destructor";
531  case SymbolKind::ConversionFunction: return "conversion-func";
532  case SymbolKind::Parameter: return "param";
533  case SymbolKind::Using: return "using";
534  case SymbolKind::TemplateTypeParm: return "template-type-param";
535  case SymbolKind::TemplateTemplateParm: return "template-template-param";
536  case SymbolKind::NonTypeTemplateParm: return "non-type-template-param";
537  }
538  llvm_unreachable("invalid symbol kind");
539 }
540 
542  switch (K) {
543  case SymbolSubKind::None: return "<none>";
544  case SymbolSubKind::CXXCopyConstructor: return "cxx-copy-ctor";
545  case SymbolSubKind::CXXMoveConstructor: return "cxx-move-ctor";
546  case SymbolSubKind::AccessorGetter: return "acc-get";
547  case SymbolSubKind::AccessorSetter: return "acc-set";
548  case SymbolSubKind::UsingTypename: return "using-typename";
549  case SymbolSubKind::UsingValue: return "using-value";
550  case SymbolSubKind::UsingEnum:
551  return "using-enum";
552  }
553  llvm_unreachable("invalid symbol subkind");
554 }
555 
557  switch (K) {
558  case SymbolLanguage::C: return "C";
559  case SymbolLanguage::ObjC: return "ObjC";
560  case SymbolLanguage::CXX: return "C++";
561  case SymbolLanguage::Swift: return "Swift";
562  }
563  llvm_unreachable("invalid symbol language kind");
564 }
565 
567  llvm::function_ref<void(SymbolProperty)> Fn) {
568 #define APPLY_FOR_PROPERTY(K) \
569  if (Props & (SymbolPropertySet)SymbolProperty::K) \
570  Fn(SymbolProperty::K)
571 
581 
582 #undef APPLY_FOR_PROPERTY
583 }
584 
585 void index::printSymbolProperties(SymbolPropertySet Props, raw_ostream &OS) {
586  bool VisitedOnce = false;
587  applyForEachSymbolProperty(Props, [&](SymbolProperty Prop) {
588  if (VisitedOnce)
589  OS << ',';
590  else
591  VisitedOnce = true;
592  switch (Prop) {
593  case SymbolProperty::Generic: OS << "Gen"; break;
594  case SymbolProperty::TemplatePartialSpecialization: OS << "TPS"; break;
595  case SymbolProperty::TemplateSpecialization: OS << "TS"; break;
596  case SymbolProperty::UnitTest: OS << "test"; break;
597  case SymbolProperty::IBAnnotated: OS << "IB"; break;
598  case SymbolProperty::IBOutletCollection: OS << "IBColl"; break;
599  case SymbolProperty::GKInspectable: OS << "GKI"; break;
600  case SymbolProperty::Local: OS << "local"; break;
601  case SymbolProperty::ProtocolInterface: OS << "protocol"; break;
602  }
603  });
604 }
clang::index::SymbolRole::AddressOf
@ AddressOf
clang::InternalLinkage
@ InternalLinkage
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
Definition: Linkage.h:31
clang::ObjCInterfaceDecl
Represents an ObjC class declaration.
Definition: DeclObjC.h:1151
clang::index::applyForEachSymbolRoleInterruptible
bool applyForEachSymbolRoleInterruptible(SymbolRoleSet Roles, llvm::function_ref< bool(SymbolRole)> Fn)
Definition: IndexSymbol.cpp:412
clang::index::SymbolProperty
SymbolProperty
Set of properties that provide additional info about a symbol.
Definition: IndexSymbol.h:83
clang::index::SymbolRole::RelationExtendedBy
@ RelationExtendedBy
clang::index::SymbolKind::Protocol
@ Protocol
clang::index::SymbolKind::Class
@ Class
clang::CXXMethodDecl::isStatic
bool isStatic() const
Definition: DeclCXX.cpp:2091
clang::index::printSymbolProperties
void printSymbolProperties(SymbolPropertySet Props, raw_ostream &OS)
Definition: IndexSymbol.cpp:585
clang::index::getSymbolSubKindString
StringRef getSymbolSubKindString(SymbolSubKind K)
Definition: IndexSymbol.cpp:541
clang::Decl::hasAttr
bool hasAttr() const
Definition: DeclBase.h:547
clang::index::SymbolLanguage::Swift
@ Swift
clang::index::SymbolLanguage::CXX
@ CXX
clang::index::SymbolKind::EnumConstant
@ EnumConstant
clang::TTK_Enum
@ TTK_Enum
The "enum" keyword.
Definition: Type.h:5322
clang::Decl::getParentFunctionOrMethod
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
Definition: DeclBase.cpp:286
clang::VisibleNoLinkage
@ VisibleNoLinkage
No linkage according to the standard, but is visible from other translation units because of types de...
Definition: Linkage.h:44
clang::index::SymbolKind::StaticMethod
@ StaticMethod
clang::if
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
Definition: RecursiveASTVisitor.h:1002
clang::TTK_Struct
@ TTK_Struct
The "struct" keyword.
Definition: Type.h:5310
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::index::SymbolRole::RelationChildOf
@ RelationChildOf
clang::index::SymbolKind::Unknown
@ Unknown
clang::index::SymbolKind::Struct
@ Struct
Attr.h
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:54
clang::index::SymbolKind::NamespaceAlias
@ NamespaceAlias
Write
@ Write
Definition: CGBuiltin.cpp:7230
clang::index::SymbolRole::Definition
@ Definition
DeclCXX.h
clang::ObjCMethodDecl::getClassInterface
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.cpp:1164
clang::FunctionDecl::TK_FunctionTemplateSpecialization
@ TK_FunctionTemplateSpecialization
Definition: Decl.h:1874
clang::index::SymbolSubKind
SymbolSubKind
Language specific sub-kinds.
Definition: IndexSymbol.h:70
clang::index::SymbolKind::Parameter
@ Parameter
clang::index::SymbolKind::TypeAlias
@ TypeAlias
clang::index::SymbolKind::Using
@ Using
clang::PrintingPolicy::SuppressTemplateArgsInCXXConstructors
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
Definition: PrettyPrinter.h:185
clang::index::SymbolSubKind::UsingTypename
@ UsingTypename
clang::MacroInfo
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:39
clang::index::SymbolProperty::Generic
@ Generic
clang::Type::isVoidType
bool isVoidType() const
Definition: Type.h:6955
clang::index::SymbolRole::Reference
@ Reference
clang::Decl::getAttr
T * getAttr() const
Definition: DeclBase.h:543
checkForIBOutlets
static void checkForIBOutlets(const Decl *D, SymbolPropertySet &PropSet)
Definition: IndexSymbol.cpp:44
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:59
clang::index::SymbolRole::Call
@ Call
clang::index::SymbolKind::NonTypeTemplateParm
@ NonTypeTemplateParm
clang::index::printSymbolRoles
void printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS)
Definition: IndexSymbol.cpp:454
clang::TTK_Interface
@ TTK_Interface
The "__interface" keyword.
Definition: Type.h:5313
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:145
clang::index::SymbolKind::Constructor
@ Constructor
clang::index::SymbolSubKind::None
@ None
clang::index::SymbolKind::TemplateTypeParm
@ TemplateTypeParm
clang::index::SymbolKind::Variable
@ Variable
DeclObjC.h
clang::index::SymbolProperty::Local
@ Local
clang::index::SymbolKind::Namespace
@ Namespace
PrettyPrinter.h
clang::index::SymbolInfo::Lang
SymbolLanguage Lang
Definition: IndexSymbol.h:145
clang::index::SymbolInfo::Kind
SymbolKind Kind
Definition: IndexSymbol.h:143
clang::index::SymbolRole::RelationOverrideOf
@ RelationOverrideOf
clang::prec::Unknown
@ Unknown
Definition: OperatorPrecedence.h:27
clang::index::SymbolSubKind::AccessorSetter
@ AccessorSetter
clang::ast_matchers::attr
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
Definition: ASTMatchersInternal.cpp:1029
DeclTemplate.h
clang::NoLinkage
@ NoLinkage
No linkage, which means that the entity is unique and can only be referred to from within its scope.
Definition: Linkage.h:26
clang::index::SymbolSubKind::CXXCopyConstructor
@ CXXCopyConstructor
clang::index::SymbolRole::Declaration
@ Declaration
clang::Selector::getNameForSlot
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
Definition: IdentifierTable.cpp:502
clang::Decl::getKind
Kind getKind() const
Definition: DeclBase.h:433
clang::index::SymbolProperty::GKInspectable
@ GKInspectable
clang::XRayInstrKind::None
constexpr XRayInstrMask None
Definition: XRayInstr.h:38
clang::index::SymbolKind::InstanceProperty
@ InstanceProperty
clang::index::SymbolSubKind::UsingEnum
@ UsingEnum
clang::index::SymbolKind::Module
@ Module
clang::index::SymbolRole::Implicit
@ Implicit
clang::index::SymbolProperty::IBOutletCollection
@ IBOutletCollection
clang::index::SymbolRole::RelationReceivedBy
@ RelationReceivedBy
APPLY_FOR_ROLE
#define APPLY_FOR_ROLE(Role)
clang::UniqueExternalLinkage
@ UniqueExternalLinkage
External linkage within a unique namespace.
Definition: Linkage.h:40
clang::index::SymbolInfo::SubKind
SymbolSubKind SubKind
Definition: IndexSymbol.h:144
clang::ObjCMethodDecl::getSelector
Selector getSelector() const
Definition: DeclObjC.h:330
clang::index::SymbolKind::Destructor
@ Destructor
clang::index::SymbolKind::Field
@ Field
clang::index::applyForEachSymbolProperty
void applyForEachSymbolProperty(SymbolPropertySet Props, llvm::function_ref< void(SymbolProperty)> Fn)
Definition: IndexSymbol.cpp:566
clang::index::SymbolLanguage::C
@ C
clang::index::SymbolProperty::ProtocolInterface
@ ProtocolInterface
Symbol is part of a protocol interface.
clang::index::SymbolRole::RelationIBTypeOf
@ RelationIBTypeOf
clang::ObjCMethodDecl::getReturnType
QualType getReturnType() const
Definition: DeclObjC.h:332
clang::TagDecl
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3328
clang::TTK_Class
@ TTK_Class
The "class" keyword.
Definition: Type.h:5319
clang::TTK_Union
@ TTK_Union
The "union" keyword.
Definition: Type.h:5316
clang::index::SymbolKind::ConversionFunction
@ ConversionFunction
clang::index::isFunctionLocalSymbol
bool isFunctionLocalSymbol(const Decl *D)
Definition: IndexSymbol.cpp:53
clang::index::SymbolKind::TemplateTemplateParm
@ TemplateTemplateParm
clang::index::SymbolRole::Dynamic
@ Dynamic
clang::index::SymbolRole::Undefinition
@ Undefinition
clang::index::SymbolRole::RelationAccessorOf
@ RelationAccessorOf
clang::index::applyForEachSymbolRole
void applyForEachSymbolRole(SymbolRoleSet Roles, llvm::function_ref< void(SymbolRole)> Fn)
Definition: IndexSymbol.cpp:446
clang::index::SymbolRole::RelationCalledBy
@ RelationCalledBy
clang::index::SymbolLanguage
SymbolLanguage
Definition: IndexSymbol.h:62
clang::index::SymbolKind::ClassMethod
@ ClassMethod
clang::index::SymbolKind::Extension
@ Extension
clang::index::SymbolProperty::IBAnnotated
@ IBAnnotated
clang::index
Definition: CommentToXML.h:22
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::index::SymbolInfo
Definition: IndexSymbol.h:142
AttributeLangSupport::ObjC
@ ObjC
Definition: SemaDeclAttr.cpp:56
clang::index::SymbolRole
SymbolRole
Set of roles that are attributed to symbol occurrences.
Definition: IndexSymbol.h:100
clang::index::getSymbolInfo
SymbolInfo getSymbolInfo(const Decl *D)
Definition: IndexSymbol.cpp:85
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
clang::index::getSymbolKindString
StringRef getSymbolKindString(SymbolKind K)
Definition: IndexSymbol.cpp:505
clang::ObjCMethodDecl::isInstanceMethod
bool isInstanceMethod() const
Definition: DeclObjC.h:431
clang::index::SymbolKind
SymbolKind
Definition: IndexSymbol.h:23
clang::index::SymbolLanguage::ObjC
@ ObjC
clang::index::SymbolRole::Read
@ Read
clang::index::SymbolRole::RelationSpecializationOf
@ RelationSpecializationOf
clang::index::getSymbolInfoForMacro
SymbolInfo getSymbolInfoForMacro(const MacroInfo &MI)
Definition: IndexSymbol.cpp:403
clang::index::SymbolSubKind::AccessorGetter
@ AccessorGetter
clang::ObjCInterfaceDecl::getSuperClass
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:339
clang::index::SymbolProperty::TemplatePartialSpecialization
@ TemplatePartialSpecialization
clang::index::SymbolProperty::UnitTest
@ UnitTest
clang::index::SymbolSubKind::UsingValue
@ UsingValue
clang::index::getSymbolLanguageString
StringRef getSymbolLanguageString(SymbolLanguage K)
Definition: IndexSymbol.cpp:556
clang::index::SymbolRole::NameReference
@ NameReference
IndexSymbol.h
isUnitTestCase
static bool isUnitTestCase(const ObjCInterfaceDecl *D)
Definition: IndexSymbol.cpp:21
clang::index::printSymbolName
bool printSymbolName(const Decl *D, const LangOptions &LO, raw_ostream &OS)
Definition: IndexSymbol.cpp:487
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::ObjCMethodDecl
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
clang::index::SymbolKind::Union
@ Union
clang
Definition: CalledOnceCheck.h:17
clang::DeclarationName::print
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Definition: DeclarationName.cpp:138
MacroInfo.h
clang::ExternalLinkage
@ ExternalLinkage
External linkage, which indicates that the entity can be referred to from other translation units.
Definition: Linkage.h:59
isUnitTest
static bool isUnitTest(const ObjCMethodDecl *D)
Definition: IndexSymbol.cpp:34
clang::index::SymbolProperty::TemplateSpecialization
@ TemplateSpecialization
unsigned
clang::ObjCMethodDecl::isPropertyAccessor
bool isPropertyAccessor() const
Definition: DeclObjC.h:441
clang::ObjCMethodDecl::parameters
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:376
clang::index::SymbolKind::InstanceMethod
@ InstanceMethod
clang::index::SymbolKind::StaticProperty
@ StaticProperty
clang::index::SymbolKind::Function
@ Function
clang::index::SymbolKind::Enum
@ Enum
clang::index::SymbolInfo::Properties
SymbolPropertySet Properties
Definition: IndexSymbol.h:146
clang::index::SymbolPropertySet
uint16_t SymbolPropertySet
Definition: IndexSymbol.h:81
clang::index::SymbolRole::RelationContainedBy
@ RelationContainedBy
clang::DeclarationName::isEmpty
bool isEmpty() const
Evaluates true when this declaration name is empty.
Definition: DeclarationName.h:372
clang::ModuleLinkage
@ ModuleLinkage
Module linkage, which indicates that the entity can be referred to from other translation units withi...
Definition: Linkage.h:55
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1856
clang::ModuleInternalLinkage
@ ModuleInternalLinkage
Internal linkage according to the Modules TS, but can be referred to from other translation units ind...
Definition: Linkage.h:49
APPLY_FOR_PROPERTY
#define APPLY_FOR_PROPERTY(K)
clang::index::SymbolRole::RelationBaseOf
@ RelationBaseOf
clang::ObjCMethodDecl::param_size
unsigned param_size() const
Definition: DeclObjC.h:350
clang::index::SymbolSubKind::CXXMoveConstructor
@ CXXMoveConstructor
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1948
clang::Decl::getDeclContext
DeclContext * getDeclContext()
Definition: DeclBase.h:439