Lines Matching refs:D
64 AttrListInfo::AttrListInfo(const Decl *D, IndexingContext &IdxCtx) in AttrListInfo() argument
67 if (!D->hasAttrs()) in AttrListInfo()
70 for (const auto *A : D->attrs()) { in AttrListInfo()
71 CXCursor C = MakeCXCursor(A, D, IdxCtx.CXTU); in AttrListInfo()
117 AttrListInfo::create(const Decl *D, IndexingContext &IdxCtx) { in create() argument
120 return new (attrs) AttrListInfo(D, IdxCtx); in create()
123 IndexingContext::CXXBasesListInfo::CXXBasesListInfo(const CXXRecordDecl *D, in CXXBasesListInfo() argument
126 for (const auto &Base : D->bases()) { in CXXBasesListInfo()
205 bool IndexingContext::isFunctionLocalDecl(const Decl *D) { in isFunctionLocalDecl() argument
206 assert(D); in isFunctionLocalDecl()
208 if (!D->getParentFunctionOrMethod()) in isFunctionLocalDecl()
211 if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) { in isFunctionLocalDecl()
309 bool IndexingContext::handleDecl(const NamedDecl *D, in handleDecl() argument
313 if (!CB.indexDeclaration || !D) in handleDecl()
315 if (D->isImplicit() && shouldIgnoreIfImplicit(D)) in handleDecl()
319 getEntityInfo(D, DInfo.EntInfo, SA); in handleDecl()
325 LexicalDC = D->getLexicalDeclContext(); in handleDecl()
328 markEntityOccurrenceInFile(D, Loc); in handleDecl()
333 DInfo.isImplicit = D->isImplicit(); in handleDecl()
338 getContainerInfo(D->getDeclContext(), DInfo.SemanticContainer); in handleDecl()
341 if (LexicalDC == D->getDeclContext()) { in handleDecl()
343 } else if (isTemplateImplicitInstantiation(D)) { in handleDecl()
357 getContainerInfo(getEntityContainer(D), DInfo.DeclAsContainer); in handleDecl()
365 bool IndexingContext::handleObjCContainer(const ObjCContainerDecl *D, in handleObjCContainer() argument
369 return handleDecl(D, Loc, Cursor, ContDInfo); in handleObjCContainer()
372 bool IndexingContext::handleFunction(const FunctionDecl *D) { in handleFunction() argument
373 bool isDef = D->isThisDeclarationADefinition(); in handleFunction()
376 if (D->hasSkippedBody()) { in handleFunction()
382 DeclInfo DInfo(!D->isFirstDecl(), isDef, isContainer); in handleFunction()
385 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleFunction()
388 bool IndexingContext::handleVar(const VarDecl *D) { in handleVar() argument
389 DeclInfo DInfo(!D->isFirstDecl(), D->isThisDeclarationADefinition(), in handleVar()
391 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleVar()
394 bool IndexingContext::handleField(const FieldDecl *D) { in handleField() argument
397 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleField()
400 bool IndexingContext::handleMSProperty(const MSPropertyDecl *D) { in handleMSProperty() argument
403 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleMSProperty()
406 bool IndexingContext::handleEnumerator(const EnumConstantDecl *D) { in handleEnumerator() argument
409 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleEnumerator()
412 bool IndexingContext::handleTagDecl(const TagDecl *D) { in handleTagDecl() argument
413 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(D)) in handleTagDecl()
414 return handleCXXRecordDecl(CXXRD, D); in handleTagDecl()
416 DeclInfo DInfo(!D->isFirstDecl(), D->isThisDeclarationADefinition(), in handleTagDecl()
417 D->isThisDeclarationADefinition()); in handleTagDecl()
418 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleTagDecl()
421 bool IndexingContext::handleTypedefName(const TypedefNameDecl *D) { in handleTypedefName() argument
422 DeclInfo DInfo(!D->isFirstDecl(), /*isDefinition=*/true, in handleTypedefName()
424 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleTypedefName()
427 bool IndexingContext::handleObjCInterface(const ObjCInterfaceDecl *D) { in handleObjCInterface() argument
429 if (!D->isThisDeclarationADefinition()) { in handleObjCInterface()
430 if (shouldSuppressRefs() && markEntityOccurrenceInFile(D, D->getLocation())) in handleObjCInterface()
434 bool isRedeclaration = D->hasDefinition() || D->getPreviousDecl(); in handleObjCInterface()
437 return handleObjCContainer(D, D->getLocation(), in handleObjCInterface()
438 MakeCursorObjCClassRef(D, D->getLocation(), in handleObjCInterface()
448 if (ObjCInterfaceDecl *SuperD = D->getSuperClass()) { in handleObjCInterface()
450 SourceLocation SuperLoc = D->getSuperClassLoc(); in handleObjCInterface()
460 ObjCProtocolListInfo ProtInfo(D->isThisDeclarationADefinition() in handleObjCInterface()
461 ? D->getReferencedProtocols() in handleObjCInterface()
465 ObjCInterfaceDeclInfo InterInfo(D); in handleObjCInterface()
468 InterInfo.ObjCInterDeclInfo.superInfo = D->getSuperClass() ? &BaseClass in handleObjCInterface()
472 return handleObjCContainer(D, D->getLocation(), getCursor(D), InterInfo); in handleObjCInterface()
476 const ObjCImplementationDecl *D) { in handleObjCImplementation() argument
480 return handleObjCContainer(D, D->getLocation(), getCursor(D), ContDInfo); in handleObjCImplementation()
483 bool IndexingContext::handleObjCProtocol(const ObjCProtocolDecl *D) { in handleObjCProtocol() argument
484 if (!D->isThisDeclarationADefinition()) { in handleObjCProtocol()
485 if (shouldSuppressRefs() && markEntityOccurrenceInFile(D, D->getLocation())) in handleObjCProtocol()
489 bool isRedeclaration = D->hasDefinition() || D->getPreviousDecl(); in handleObjCProtocol()
493 return handleObjCContainer(D, D->getLocation(), in handleObjCProtocol()
494 MakeCursorObjCProtocolRef(D, D->getLocation(), in handleObjCProtocol()
501 ObjCProtocolListInfo ProtListInfo(D->isThisDeclarationADefinition() in handleObjCProtocol()
502 ? D->getReferencedProtocols() in handleObjCProtocol()
506 ObjCProtocolDeclInfo ProtInfo(D); in handleObjCProtocol()
509 return handleObjCContainer(D, D->getLocation(), getCursor(D), ProtInfo); in handleObjCProtocol()
512 bool IndexingContext::handleObjCCategory(const ObjCCategoryDecl *D) { in handleObjCCategory() argument
517 const ObjCInterfaceDecl *IFaceD = D->getClassInterface(); in handleObjCCategory()
518 SourceLocation ClassLoc = D->getLocation(); in handleObjCCategory()
519 SourceLocation CategoryLoc = D->IsClassExtension() ? ClassLoc in handleObjCCategory()
520 : D->getCategoryNameLoc(); in handleObjCCategory()
526 ObjCProtocolListInfo ProtInfo(D->getReferencedProtocols(), *this, SA); in handleObjCCategory()
541 return handleObjCContainer(D, CategoryLoc, getCursor(D), CatDInfo); in handleObjCCategory()
544 bool IndexingContext::handleObjCCategoryImpl(const ObjCCategoryImplDecl *D) { in handleObjCCategoryImpl() argument
547 const ObjCCategoryDecl *CatD = D->getCategoryDecl(); in handleObjCCategoryImpl()
551 SourceLocation ClassLoc = D->getLocation(); in handleObjCCategoryImpl()
552 SourceLocation CategoryLoc = D->getCategoryNameLoc(); in handleObjCCategoryImpl()
570 return handleObjCContainer(D, CategoryLoc, getCursor(D), CatDInfo); in handleObjCCategoryImpl()
573 bool IndexingContext::handleObjCMethod(const ObjCMethodDecl *D) { in handleObjCMethod() argument
574 bool isDef = D->isThisDeclarationADefinition(); in handleObjCMethod()
577 if (D->hasSkippedBody()) { in handleObjCMethod()
583 DeclInfo DInfo(!D->isCanonicalDecl(), isDef, isContainer); in handleObjCMethod()
586 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleObjCMethod()
590 const ObjCPropertyImplDecl *D) { in handleSynthesizedObjCProperty() argument
591 ObjCPropertyDecl *PD = D->getPropertyDecl(); in handleSynthesizedObjCProperty()
592 return handleReference(PD, D->getLocation(), getCursor(D), nullptr, in handleSynthesizedObjCProperty()
593 D->getDeclContext()); in handleSynthesizedObjCProperty()
596 bool IndexingContext::handleSynthesizedObjCMethod(const ObjCMethodDecl *D, in handleSynthesizedObjCMethod() argument
601 return handleDecl(D, Loc, getCursor(D), DInfo, LexicalDC); in handleSynthesizedObjCMethod()
604 bool IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) { in handleObjCProperty() argument
613 if (ObjCMethodDecl *Getter = D->getGetterMethodDecl()) { in handleObjCProperty()
619 if (ObjCMethodDecl *Setter = D->getSetterMethodDecl()) { in handleObjCProperty()
626 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleObjCProperty()
629 bool IndexingContext::handleNamespace(const NamespaceDecl *D) { in handleNamespace() argument
630 DeclInfo DInfo(/*isRedeclaration=*/!D->isOriginalNamespace(), in handleNamespace()
633 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleNamespace()
636 bool IndexingContext::handleClassTemplate(const ClassTemplateDecl *D) { in handleClassTemplate() argument
637 return handleCXXRecordDecl(D->getTemplatedDecl(), D); in handleClassTemplate()
640 bool IndexingContext::handleFunctionTemplate(const FunctionTemplateDecl *D) { in handleFunctionTemplate() argument
641 DeclInfo DInfo(/*isRedeclaration=*/!D->isCanonicalDecl(), in handleFunctionTemplate()
642 /*isDefinition=*/D->isThisDeclarationADefinition(), in handleFunctionTemplate()
643 /*isContainer=*/D->isThisDeclarationADefinition()); in handleFunctionTemplate()
644 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleFunctionTemplate()
647 bool IndexingContext::handleTypeAliasTemplate(const TypeAliasTemplateDecl *D) { in handleTypeAliasTemplate() argument
648 DeclInfo DInfo(/*isRedeclaration=*/!D->isCanonicalDecl(), in handleTypeAliasTemplate()
650 return handleDecl(D, D->getLocation(), getCursor(D), DInfo); in handleTypeAliasTemplate()
653 bool IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, in handleReference() argument
658 if (!D) in handleReference()
662 : getRefCursor(D, Loc); in handleReference()
663 return handleReference(D, Loc, Cursor, Parent, DC, E, Kind); in handleReference()
666 bool IndexingContext::handleReference(const NamedDecl *D, SourceLocation Loc, in handleReference() argument
675 if (!D) in handleReference()
679 if (!shouldIndexFunctionLocalSymbols() && isFunctionLocalDecl(D)) in handleReference()
681 if (isNotFromSourceFile(D->getLocation())) in handleReference()
683 if (D->isImplicit() && shouldIgnoreIfImplicit(D)) in handleReference()
687 if (markEntityOccurrenceInFile(D, Loc)) in handleReference()
693 getEntityInfo(D, RefEntity, SA); in handleReference()
740 CXIdxClientEntity IndexingContext::getClientEntity(const Decl *D) const { in getClientEntity()
741 if (!D) in getClientEntity()
743 EntityMapTy::const_iterator I = EntityMap.find(D); in getClientEntity()
749 void IndexingContext::setClientEntity(const Decl *D, CXIdxClientEntity client) { in setClientEntity() argument
750 if (!D) in setClientEntity()
752 EntityMap[D] = client; in setClientEntity()
788 bool IndexingContext::markEntityOccurrenceInFile(const NamedDecl *D, in markEntityOccurrenceInFile() argument
790 if (!D || Loc.isInvalid()) in markEntityOccurrenceInFile()
794 D = getEntityDecl(D); in markEntityOccurrenceInFile()
804 RefFileOccurrence RefOccur(FE, D); in markEntityOccurrenceInFile()
813 const NamedDecl *IndexingContext::getEntityDecl(const NamedDecl *D) const { in getEntityDecl()
814 assert(D); in getEntityDecl()
815 D = cast<NamedDecl>(D->getCanonicalDecl()); in getEntityDecl()
818 ImplD = dyn_cast<ObjCImplementationDecl>(D)) { in getEntityDecl()
822 CatImplD = dyn_cast<ObjCCategoryImplDecl>(D)) { in getEntityDecl()
824 } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { in getEntityDecl()
827 } else if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) { in getEntityDecl()
832 return D; in getEntityDecl()
836 IndexingContext::getEntityContainer(const Decl *D) const { in getEntityContainer()
837 const DeclContext *DC = dyn_cast<DeclContext>(D); in getEntityContainer()
841 if (const ClassTemplateDecl *ClassTempl = dyn_cast<ClassTemplateDecl>(D)) { in getEntityContainer()
844 FuncTempl = dyn_cast<FunctionTemplateDecl>(D)) { in getEntityContainer()
914 void IndexingContext::getEntityInfo(const NamedDecl *D, in getEntityInfo() argument
917 if (!D) in getEntityInfo()
920 D = getEntityDecl(D); in getEntityInfo()
921 EntityInfo.cursor = getCursor(D); in getEntityInfo()
922 EntityInfo.Dcl = D; in getEntityInfo()
928 if (D->hasAttrs()) { in getEntityInfo()
929 EntityInfo.AttrList = AttrListInfo::create(D, *this); in getEntityInfo()
934 if (const TagDecl *TD = dyn_cast<TagDecl>(D)) { in getEntityInfo()
952 if (const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D)) in getEntityInfo()
956 if (isa<ClassTemplatePartialSpecializationDecl>(D)) { in getEntityInfo()
958 } else if (isa<ClassTemplateSpecializationDecl>(D)) { in getEntityInfo()
963 switch (D->getKind()) { in getEntityInfo()
974 if (isa<CXXRecordDecl>(D->getDeclContext())) { in getEntityInfo()
982 CXXRec = dyn_cast<CXXRecordDecl>(D->getDeclContext())) { in getEntityInfo()
1004 if (cast<ObjCMethodDecl>(D)->isInstanceMethod()) in getEntityInfo()
1039 const CXXMethodDecl *MD = cast<CXXMethodDecl>(D); in getEntityInfo()
1055 cast<FunctionTemplateDecl>(D)->getTemplatedDecl())) { in getEntityInfo()
1086 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { in getEntityInfo()
1095 if (IdentifierInfo *II = D->getIdentifier()) { in getEntityInfo()
1098 } else if (isa<TagDecl>(D) || isa<FieldDecl>(D) || isa<NamespaceDecl>(D)) { in getEntityInfo()
1105 D->printName(OS); in getEntityInfo()
1112 bool Ignore = getDeclCursorUSR(D, StrBuf); in getEntityInfo()
1128 CXCursor IndexingContext::getRefCursor(const NamedDecl *D, SourceLocation Loc) { in getRefCursor() argument
1129 if (const TypeDecl *TD = dyn_cast<TypeDecl>(D)) in getRefCursor()
1131 if (const ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D)) in getRefCursor()
1133 if (const ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D)) in getRefCursor()
1135 if (const TemplateDecl *Template = dyn_cast<TemplateDecl>(D)) in getRefCursor()
1137 if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(D)) in getRefCursor()
1139 if (const NamespaceAliasDecl *Namespace = dyn_cast<NamespaceAliasDecl>(D)) in getRefCursor()
1141 if (const FieldDecl *Field = dyn_cast<FieldDecl>(D)) in getRefCursor()
1143 if (const VarDecl *Var = dyn_cast<VarDecl>(D)) in getRefCursor()
1149 bool IndexingContext::shouldIgnoreIfImplicit(const Decl *D) { in shouldIgnoreIfImplicit() argument
1150 if (isa<ObjCInterfaceDecl>(D)) in shouldIgnoreIfImplicit()
1152 if (isa<ObjCCategoryDecl>(D)) in shouldIgnoreIfImplicit()
1154 if (isa<ObjCIvarDecl>(D)) in shouldIgnoreIfImplicit()
1156 if (isa<ObjCMethodDecl>(D)) in shouldIgnoreIfImplicit()
1158 if (isa<ImportDecl>(D)) in shouldIgnoreIfImplicit()
1163 bool IndexingContext::isTemplateImplicitInstantiation(const Decl *D) { in isTemplateImplicitInstantiation() argument
1165 SD = dyn_cast<ClassTemplateSpecializationDecl>(D)) { in isTemplateImplicitInstantiation()
1168 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { in isTemplateImplicitInstantiation()