Lines Matching defs:D
35 bool VisitFunctionDecl(const FunctionDecl *D) {
36 DataConsumer.handleFunction(D);
40 bool VisitVarDecl(const VarDecl *D) {
41 DataConsumer.handleVar(D);
45 bool VisitFieldDecl(const FieldDecl *D) {
46 DataConsumer.handleField(D);
50 bool VisitMSPropertyDecl(const MSPropertyDecl *D) {
54 bool VisitEnumConstantDecl(const EnumConstantDecl *D) {
55 DataConsumer.handleEnumerator(D);
59 bool VisitTypedefNameDecl(const TypedefNameDecl *D) {
60 DataConsumer.handleTypedefName(D);
64 bool VisitTagDecl(const TagDecl *D) {
65 DataConsumer.handleTagDecl(D);
69 bool VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D) {
70 DataConsumer.handleObjCInterface(D);
74 bool VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {
75 DataConsumer.handleObjCProtocol(D);
79 bool VisitObjCImplementationDecl(const ObjCImplementationDecl *D) {
80 DataConsumer.handleObjCImplementation(D);
84 bool VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {
85 DataConsumer.handleObjCCategory(D);
89 bool VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D) {
90 DataConsumer.handleObjCCategoryImpl(D);
94 bool VisitObjCMethodDecl(const ObjCMethodDecl *D) {
95 if (isa<ObjCImplDecl>(LexicalDC) && !D->isThisDeclarationADefinition())
96 DataConsumer.handleSynthesizedObjCMethod(D, DeclLoc, LexicalDC);
98 DataConsumer.handleObjCMethod(D, DeclLoc);
102 bool VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {
103 DataConsumer.handleObjCProperty(D);
107 bool VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {
108 DataConsumer.handleSynthesizedObjCProperty(D);
112 bool VisitNamespaceDecl(const NamespaceDecl *D) {
113 DataConsumer.handleNamespace(D);
117 bool VisitUsingDecl(const UsingDecl *D) {
121 bool VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
125 bool VisitClassTemplateDecl(const ClassTemplateDecl *D) {
126 DataConsumer.handleClassTemplate(D);
131 ClassTemplateSpecializationDecl *D) {
132 DataConsumer.handleTagDecl(D);
136 bool VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
137 DataConsumer.handleFunctionTemplate(D);
141 bool VisitTypeAliasTemplateDecl(const TypeAliasTemplateDecl *D) {
142 DataConsumer.handleTypeAliasTemplate(D);
146 bool VisitImportDecl(const ImportDecl *D) {
147 DataConsumer.importedModule(D);
151 bool VisitConceptDecl(const ConceptDecl *D) {
152 DataConsumer.handleConcept(D);
164 const Decl *D, SymbolRoleSet Roles, ArrayRef<SymbolRelation> Relations,
169 const NamedDecl *ND = dyn_cast<NamedDecl>(D);
285 AttrListInfo::AttrListInfo(const Decl *D, CXIndexDataConsumer &IdxCtx)
288 if (!D->hasAttrs())
291 for (const auto *A : D->attrs()) {
292 CXCursor C = MakeCXCursor(A, D, IdxCtx.CXTU);
338 AttrListInfo::create(const Decl *D, CXIndexDataConsumer &IdxCtx) {
341 return new (attrs) AttrListInfo(D, IdxCtx);
344 CXIndexDataConsumer::CXXBasesListInfo::CXXBasesListInfo(const CXXRecordDecl *D,
347 for (const auto &Base : D->bases()) {
426 bool CXIndexDataConsumer::isFunctionLocalDecl(const Decl *D) {
427 assert(D);
429 if (!D->getParentFunctionOrMethod())
432 if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
544 bool CXIndexDataConsumer::handleDecl(const NamedDecl *D,
549 if (!CB.indexDeclaration || !D)
551 if (D->isImplicit() && shouldIgnoreIfImplicit(D))
555 getEntityInfo(D, DInfo.EntInfo, SA);
561 LexicalDC = D->getLexicalDeclContext();
564 markEntityOccurrenceInFile(D, Loc);
569 DInfo.isImplicit = D->isImplicit();
575 SemaDC = D->getDeclContext();
581 } else if (isTemplateImplicitInstantiation(D)) {
595 getContainerInfo(getEntityContainer(D), DInfo.DeclAsContainer);
603 bool CXIndexDataConsumer::handleObjCContainer(const ObjCContainerDecl *D,
607 return handleDecl(D, Loc, Cursor, ContDInfo);
610 bool CXIndexDataConsumer::handleFunction(const FunctionDecl *D) {
611 bool isDef = D->isThisDeclarationADefinition();
614 if (D->hasSkippedBody()) {
620 DeclInfo DInfo(!D->isFirstDecl(), isDef, isContainer);
623 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
626 bool CXIndexDataConsumer::handleVar(const VarDecl *D) {
627 DeclInfo DInfo(!D->isFirstDecl(), D->isThisDeclarationADefinition(),
629 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
632 bool CXIndexDataConsumer::handleField(const FieldDecl *D) {
635 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
638 bool CXIndexDataConsumer::handleEnumerator(const EnumConstantDecl *D) {
641 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
644 bool CXIndexDataConsumer::handleTagDecl(const TagDecl *D) {
645 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(D))
646 return handleCXXRecordDecl(CXXRD, D);
648 DeclInfo DInfo(!D->isFirstDecl(), D->isThisDeclarationADefinition(),
649 D->isThisDeclarationADefinition());
650 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
653 bool CXIndexDataConsumer::handleTypedefName(const TypedefNameDecl *D) {
654 DeclInfo DInfo(!D->isFirstDecl(), /*isDefinition=*/true,
656 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
659 bool CXIndexDataConsumer::handleObjCInterface(const ObjCInterfaceDecl *D) {
661 if (!D->isThisDeclarationADefinition()) {
662 if (shouldSuppressRefs() && markEntityOccurrenceInFile(D, D->getLocation()))
666 bool isRedeclaration = D->hasDefinition() || D->getPreviousDecl();
669 return handleObjCContainer(D, D->getLocation(),
670 MakeCursorObjCClassRef(D, D->getLocation(),
680 if (ObjCInterfaceDecl *SuperD = D->getSuperClass()) {
682 SourceLocation SuperLoc = D->getSuperClassLoc();
692 ObjCProtocolListInfo ProtInfo(D->isThisDeclarationADefinition()
693 ? D->getReferencedProtocols()
697 ObjCInterfaceDeclInfo InterInfo(D);
700 InterInfo.ObjCInterDeclInfo.superInfo = D->getSuperClass() ? &BaseClass
704 return handleObjCContainer(D, D->getLocation(), getCursor(D), InterInfo);
708 const ObjCImplementationDecl *D) {
712 return handleObjCContainer(D, D->getLocation(), getCursor(D), ContDInfo);
715 bool CXIndexDataConsumer::handleObjCProtocol(const ObjCProtocolDecl *D) {
716 if (!D->isThisDeclarationADefinition()) {
717 if (shouldSuppressRefs() && markEntityOccurrenceInFile(D, D->getLocation()))
721 bool isRedeclaration = D->hasDefinition() || D->getPreviousDecl();
725 return handleObjCContainer(D, D->getLocation(),
726 MakeCursorObjCProtocolRef(D, D->getLocation(),
733 ObjCProtocolListInfo ProtListInfo(D->isThisDeclarationADefinition()
734 ? D->getReferencedProtocols()
738 ObjCProtocolDeclInfo ProtInfo(D);
741 return handleObjCContainer(D, D->getLocation(), getCursor(D), ProtInfo);
744 bool CXIndexDataConsumer::handleObjCCategory(const ObjCCategoryDecl *D) {
749 const ObjCInterfaceDecl *IFaceD = D->getClassInterface();
750 SourceLocation ClassLoc = D->getLocation();
751 SourceLocation CategoryLoc = D->IsClassExtension() ? ClassLoc
752 : D->getCategoryNameLoc();
758 ObjCProtocolListInfo ProtInfo(D->getReferencedProtocols(), *this, SA);
773 return handleObjCContainer(D, CategoryLoc, getCursor(D), CatDInfo);
776 bool CXIndexDataConsumer::handleObjCCategoryImpl(const ObjCCategoryImplDecl *D) {
779 const ObjCCategoryDecl *CatD = D->getCategoryDecl();
783 SourceLocation ClassLoc = D->getLocation();
784 SourceLocation CategoryLoc = D->getCategoryNameLoc();
802 return handleObjCContainer(D, CategoryLoc, getCursor(D), CatDInfo);
805 bool CXIndexDataConsumer::handleObjCMethod(const ObjCMethodDecl *D,
807 bool isDef = D->isThisDeclarationADefinition();
810 if (D->hasSkippedBody()) {
816 DeclInfo DInfo(!D->isCanonicalDecl(), isDef, isContainer);
819 return handleDecl(D, Loc, getCursor(D), DInfo);
823 const ObjCPropertyImplDecl *D) {
824 ObjCPropertyDecl *PD = D->getPropertyDecl();
825 auto *DC = D->getDeclContext();
826 return handleReference(PD, D->getLocation(), getCursor(D),
830 bool CXIndexDataConsumer::handleSynthesizedObjCMethod(const ObjCMethodDecl *D,
835 return handleDecl(D, Loc, getCursor(D), DInfo, LexicalDC, D->getDeclContext());
838 bool CXIndexDataConsumer::handleObjCProperty(const ObjCPropertyDecl *D) {
847 if (ObjCMethodDecl *Getter = D->getGetterMethodDecl()) {
853 if (ObjCMethodDecl *Setter = D->getSetterMethodDecl()) {
860 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
863 bool CXIndexDataConsumer::handleNamespace(const NamespaceDecl *D) {
864 DeclInfo DInfo(/*isRedeclaration=*/!D->isFirstDecl(),
867 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
870 bool CXIndexDataConsumer::handleClassTemplate(const ClassTemplateDecl *D) {
871 return handleCXXRecordDecl(D->getTemplatedDecl(), D);
874 bool CXIndexDataConsumer::handleFunctionTemplate(const FunctionTemplateDecl *D) {
875 DeclInfo DInfo(/*isRedeclaration=*/!D->isCanonicalDecl(),
876 /*isDefinition=*/D->isThisDeclarationADefinition(),
877 /*isContainer=*/D->isThisDeclarationADefinition());
878 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
881 bool CXIndexDataConsumer::handleTypeAliasTemplate(const TypeAliasTemplateDecl *D) {
882 DeclInfo DInfo(/*isRedeclaration=*/!D->isCanonicalDecl(),
884 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
887 bool CXIndexDataConsumer::handleConcept(const ConceptDecl *D) {
888 DeclInfo DInfo(/*isRedeclaration=*/!D->isCanonicalDecl(),
890 return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
893 bool CXIndexDataConsumer::handleReference(const NamedDecl *D, SourceLocation Loc,
903 if (!D || !DC)
907 if (!shouldIndexFunctionLocalSymbols() && isFunctionLocalDecl(D))
909 if (isNotFromSourceFile(D->getLocation()))
911 if (D->isImplicit() && shouldIgnoreIfImplicit(D))
915 if (markEntityOccurrenceInFile(D, Loc))
921 getEntityInfo(D, RefEntity, SA);
963 CXIdxClientEntity CXIndexDataConsumer::getClientEntity(const Decl *D) const {
964 return D ? EntityMap.lookup(D) : nullptr;
967 void CXIndexDataConsumer::setClientEntity(const Decl *D, CXIdxClientEntity client) {
968 if (!D)
970 EntityMap[D] = client;
1006 bool CXIndexDataConsumer::markEntityOccurrenceInFile(const NamedDecl *D,
1008 if (!D || Loc.isInvalid())
1012 D = getEntityDecl(D);
1022 RefFileOccurrence RefOccur(FE, D);
1028 const NamedDecl *CXIndexDataConsumer::getEntityDecl(const NamedDecl *D) const {
1029 assert(D);
1030 D = cast<NamedDecl>(D->getCanonicalDecl());
1033 ImplD = dyn_cast<ObjCImplementationDecl>(D)) {
1037 CatImplD = dyn_cast<ObjCCategoryImplDecl>(D)) {
1039 } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
1042 } else if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
1047 return D;
1051 CXIndexDataConsumer::getEntityContainer(const Decl *D) const {
1052 const DeclContext *DC = dyn_cast<DeclContext>(D);
1056 if (const ClassTemplateDecl *ClassTempl = dyn_cast<ClassTemplateDecl>(D)) {
1059 FuncTempl = dyn_cast<FunctionTemplateDecl>(D)) {
1120 void CXIndexDataConsumer::getEntityInfo(const NamedDecl *D,
1123 if (!D)
1126 D = getEntityDecl(D);
1127 EntityInfo.cursor = getCursor(D);
1128 EntityInfo.Dcl = D;
1131 SymbolInfo SymInfo = getSymbolInfo(D);
1136 if (D->hasAttrs()) {
1137 EntityInfo.AttrList = AttrListInfo::create(D, *this);
1145 if (IdentifierInfo *II = D->getIdentifier()) {
1148 } else if (isa<TagDecl>(D) || isa<FieldDecl>(D) || isa<NamespaceDecl>(D)) {
1155 D->printName(OS);
1162 bool Ignore = getDeclCursorUSR(D, StrBuf);
1178 CXCursor CXIndexDataConsumer::getRefCursor(const NamedDecl *D, SourceLocation Loc) {
1179 if (const TypeDecl *TD = dyn_cast<TypeDecl>(D))
1181 if (const ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D))
1183 if (const ObjCProtocolDecl *PD = dyn_cast<ObjCProtocolDecl>(D))
1185 if (const TemplateDecl *Template = dyn_cast<TemplateDecl>(D))
1187 if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(D))
1189 if (const NamespaceAliasDecl *Namespace = dyn_cast<NamespaceAliasDecl>(D))
1191 if (const FieldDecl *Field = dyn_cast<FieldDecl>(D))
1193 if (const VarDecl *Var = dyn_cast<VarDecl>(D))
1199 bool CXIndexDataConsumer::shouldIgnoreIfImplicit(const Decl *D) {
1200 if (isa<ObjCInterfaceDecl>(D))
1202 if (isa<ObjCCategoryDecl>(D))
1204 if (isa<ObjCIvarDecl>(D))
1206 if (isa<ObjCMethodDecl>(D))
1208 if (isa<ImportDecl>(D))
1213 bool CXIndexDataConsumer::isTemplateImplicitInstantiation(const Decl *D) {
1215 SD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
1218 if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {