Lines Matching refs:D
75 void VisitDeclContext(const DeclContext *D);
76 void VisitFieldDecl(const FieldDecl *D);
77 void VisitFunctionDecl(const FunctionDecl *D);
78 void VisitNamedDecl(const NamedDecl *D);
79 void VisitNamespaceDecl(const NamespaceDecl *D);
80 void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
81 void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
82 void VisitClassTemplateDecl(const ClassTemplateDecl *D);
85 void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
86 void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
87 void VisitTagDecl(const TagDecl *D);
88 void VisitTypedefDecl(const TypedefDecl *D);
89 void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
90 void VisitVarDecl(const VarDecl *D);
91 void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
92 void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
94 void VisitLinkageSpecDecl(const LinkageSpecDecl *D) { in VisitLinkageSpecDecl() argument
98 void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) { in VisitUsingDirectiveDecl() argument
102 void VisitUsingDecl(const UsingDecl *D) { in VisitUsingDecl() argument
106 void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { in VisitUnresolvedUsingValueDecl() argument
110 void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { in VisitUnresolvedUsingTypenameDecl() argument
114 bool ShouldGenerateLocation(const NamedDecl *D);
116 bool isLocal(const NamedDecl *D) { in isLocal() argument
117 return D->getParentFunctionOrMethod() != nullptr; in isLocal()
122 bool GenLoc(const Decl *D, bool IncludeOffset);
157 bool EmitDeclName(const NamedDecl *D);
165 bool USRGenerator::EmitDeclName(const NamedDecl *D) { in EmitDeclName() argument
167 D->printName(Out); in EmitDeclName()
172 bool USRGenerator::ShouldGenerateLocation(const NamedDecl *D) { in ShouldGenerateLocation() argument
173 if (D->isExternallyVisible()) in ShouldGenerateLocation()
175 if (D->getParentFunctionOrMethod()) in ShouldGenerateLocation()
178 return !SM.isInSystemHeader(D->getLocation()); in ShouldGenerateLocation()
182 if (const NamedDecl *D = dyn_cast<NamedDecl>(DC)) in VisitDeclContext() local
183 Visit(D); in VisitDeclContext()
186 void USRGenerator::VisitFieldDecl(const FieldDecl *D) { in VisitFieldDecl() argument
189 if (const ObjCInterfaceDecl *ID = Context->getObjContainingInterface(D)) in VisitFieldDecl()
192 VisitDeclContext(D->getDeclContext()); in VisitFieldDecl()
193 Out << (isa<ObjCIvarDecl>(D) ? "@" : "@FI@"); in VisitFieldDecl()
194 if (EmitDeclName(D)) { in VisitFieldDecl()
201 void USRGenerator::VisitFunctionDecl(const FunctionDecl *D) { in VisitFunctionDecl() argument
202 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitFunctionDecl()
205 VisitDeclContext(D->getDeclContext()); in VisitFunctionDecl()
207 if (FunctionTemplateDecl *FunTmpl = D->getDescribedFunctionTemplate()) { in VisitFunctionDecl()
218 D->getDeclName().print(Out, Policy); in VisitFunctionDecl()
221 if ((!Ctx.getLangOpts().CPlusPlus || D->isExternC()) && in VisitFunctionDecl()
222 !D->hasAttr<OverloadableAttr>()) in VisitFunctionDecl()
226 SpecArgs = D->getTemplateSpecializationArgs()) { in VisitFunctionDecl()
236 for (auto PD : D->parameters()) { in VisitFunctionDecl()
240 if (D->isVariadic()) in VisitFunctionDecl()
249 VisitType(D->getReturnType()); in VisitFunctionDecl()
252 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { in VisitFunctionDecl()
265 void USRGenerator::VisitNamedDecl(const NamedDecl *D) { in VisitNamedDecl() argument
266 VisitDeclContext(D->getDeclContext()); in VisitNamedDecl()
269 if (EmitDeclName(D)) { in VisitNamedDecl()
278 void USRGenerator::VisitVarDecl(const VarDecl *D) { in VisitVarDecl() argument
282 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitVarDecl()
285 VisitDeclContext(D->getDeclContext()); in VisitVarDecl()
288 StringRef s = D->getName(); in VisitVarDecl()
301 const NonTypeTemplateParmDecl *D) { in VisitNonTypeTemplateParmDecl() argument
302 GenLoc(D, /*IncludeOffset=*/true); in VisitNonTypeTemplateParmDecl()
306 const TemplateTemplateParmDecl *D) { in VisitTemplateTemplateParmDecl() argument
307 GenLoc(D, /*IncludeOffset=*/true); in VisitTemplateTemplateParmDecl()
310 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) { in VisitNamespaceDecl() argument
311 if (D->isAnonymousNamespace()) { in VisitNamespaceDecl()
316 VisitDeclContext(D->getDeclContext()); in VisitNamespaceDecl()
318 Out << "@N@" << D->getName(); in VisitNamespaceDecl()
321 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { in VisitFunctionTemplateDecl() argument
322 VisitFunctionDecl(D->getTemplatedDecl()); in VisitFunctionTemplateDecl()
325 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) { in VisitClassTemplateDecl() argument
326 VisitTagDecl(D->getTemplatedDecl()); in VisitClassTemplateDecl()
329 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) { in VisitNamespaceAliasDecl() argument
330 VisitDeclContext(D->getDeclContext()); in VisitNamespaceAliasDecl()
332 Out << "@NA@" << D->getName(); in VisitNamespaceAliasDecl()
335 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { in VisitObjCMethodDecl() argument
336 const DeclContext *container = D->getDeclContext(); in VisitObjCMethodDecl()
343 const ObjCInterfaceDecl *ID = D->getClassInterface(); in VisitObjCMethodDecl()
353 Out << (D->isInstanceMethod() ? "(im)" : "(cm)") in VisitObjCMethodDecl()
354 << DeclarationName(D->getSelector()); in VisitObjCMethodDecl()
357 void USRGenerator::VisitObjCContainerDecl(const ObjCContainerDecl *D) { in VisitObjCContainerDecl() argument
358 switch (D->getKind()) { in VisitObjCContainerDecl()
363 GenObjCClass(D->getName()); in VisitObjCContainerDecl()
366 const ObjCCategoryDecl *CD = cast<ObjCCategoryDecl>(D); in VisitObjCContainerDecl()
388 const ObjCCategoryImplDecl *CD = cast<ObjCCategoryImplDecl>(D); in VisitObjCContainerDecl()
402 GenObjCProtocol(cast<ObjCProtocolDecl>(D)->getName()); in VisitObjCContainerDecl()
407 void USRGenerator::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) { in VisitObjCPropertyDecl() argument
410 if (const ObjCInterfaceDecl *ID = Context->getObjContainingInterface(D)) in VisitObjCPropertyDecl()
413 Visit(cast<Decl>(D->getDeclContext())); in VisitObjCPropertyDecl()
414 GenObjCProperty(D->getName()); in VisitObjCPropertyDecl()
417 void USRGenerator::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) { in VisitObjCPropertyImplDecl() argument
418 if (ObjCPropertyDecl *PD = D->getPropertyDecl()) { in VisitObjCPropertyImplDecl()
426 void USRGenerator::VisitTagDecl(const TagDecl *D) { in VisitTagDecl() argument
429 if (!isa<EnumDecl>(D) && in VisitTagDecl()
430 ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitTagDecl()
433 D = D->getCanonicalDecl(); in VisitTagDecl()
434 VisitDeclContext(D->getDeclContext()); in VisitTagDecl()
437 if (const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) { in VisitTagDecl()
441 switch (D->getTagKind()) { in VisitTagDecl()
453 switch (D->getTagKind()) { in VisitTagDecl()
465 switch (D->getTagKind()) { in VisitTagDecl()
478 if (EmitDeclName(D)) { in VisitTagDecl()
479 if (const TypedefNameDecl *TD = D->getTypedefNameForAnonDecl()) { in VisitTagDecl()
484 if (D->isEmbeddedInDeclarator() && !D->isFreeStanding()) { in VisitTagDecl()
485 printLoc(Out, D->getLocation(), Context->getSourceManager(), true); in VisitTagDecl()
488 if (auto *ED = dyn_cast<EnumDecl>(D)) { in VisitTagDecl()
501 = dyn_cast<ClassTemplateSpecializationDecl>(D)) { in VisitTagDecl()
511 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) { in VisitTypedefDecl() argument
512 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitTypedefDecl()
514 const DeclContext *DC = D->getDeclContext(); in VisitTypedefDecl()
518 Out << D->getName(); in VisitTypedefDecl()
521 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { in VisitTemplateTypeParmDecl() argument
522 GenLoc(D, /*IncludeOffset=*/true); in VisitTemplateTypeParmDecl()
525 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) { in GenLoc() argument
531 if (!D) { in GenLoc()
537 D = D->getCanonicalDecl(); in GenLoc()
540 IgnoreResults || printLoc(Out, D->getLocStart(), in GenLoc()
875 bool clang::index::generateUSRForDecl(const Decl *D, in generateUSRForDecl() argument
878 if (!D || D->getLocStart().isInvalid()) in generateUSRForDecl()
881 USRGenerator UG(&D->getASTContext(), Buf); in generateUSRForDecl()
882 UG.Visit(D); in generateUSRForDecl()