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);
93 void VisitLinkageSpecDecl(const LinkageSpecDecl *D) { in VisitLinkageSpecDecl() argument
96 void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) { in VisitUsingDirectiveDecl() argument
99 void VisitUsingDecl(const UsingDecl *D) { in VisitUsingDecl() argument
102 void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { in VisitUnresolvedUsingValueDecl() argument
105 void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { in VisitUnresolvedUsingTypenameDecl() argument
109 bool ShouldGenerateLocation(const NamedDecl *D);
111 bool isLocal(const NamedDecl *D) { in isLocal() argument
112 return D->getParentFunctionOrMethod() != nullptr; in isLocal()
117 bool GenLoc(const Decl *D, bool IncludeOffset);
149 bool EmitDeclName(const NamedDecl *D);
158 bool USRGenerator::EmitDeclName(const NamedDecl *D) { in EmitDeclName() argument
160 D->printName(Out); in EmitDeclName()
165 bool USRGenerator::ShouldGenerateLocation(const NamedDecl *D) { in ShouldGenerateLocation() argument
166 if (D->isExternallyVisible()) in ShouldGenerateLocation()
168 if (D->getParentFunctionOrMethod()) in ShouldGenerateLocation()
171 return !SM.isInSystemHeader(D->getLocation()); in ShouldGenerateLocation()
175 if (const NamedDecl *D = dyn_cast<NamedDecl>(DC)) in VisitDeclContext() local
176 Visit(D); in VisitDeclContext()
179 void USRGenerator::VisitFieldDecl(const FieldDecl *D) { in VisitFieldDecl() argument
182 if (const ObjCInterfaceDecl *ID = Context->getObjContainingInterface(D)) in VisitFieldDecl()
185 VisitDeclContext(D->getDeclContext()); in VisitFieldDecl()
186 Out << (isa<ObjCIvarDecl>(D) ? "@" : "@FI@"); in VisitFieldDecl()
187 if (EmitDeclName(D)) { in VisitFieldDecl()
194 void USRGenerator::VisitFunctionDecl(const FunctionDecl *D) { in VisitFunctionDecl() argument
195 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitFunctionDecl()
198 VisitDeclContext(D->getDeclContext()); in VisitFunctionDecl()
200 if (FunctionTemplateDecl *FunTmpl = D->getDescribedFunctionTemplate()) { in VisitFunctionDecl()
206 D->printName(Out); in VisitFunctionDecl()
209 if (!Ctx.getLangOpts().CPlusPlus || D->isExternC()) in VisitFunctionDecl()
213 SpecArgs = D->getTemplateSpecializationArgs()) { in VisitFunctionDecl()
223 for (auto PD : D->params()) { in VisitFunctionDecl()
227 if (D->isVariadic()) in VisitFunctionDecl()
236 VisitType(D->getReturnType()); in VisitFunctionDecl()
239 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) { in VisitFunctionDecl()
252 void USRGenerator::VisitNamedDecl(const NamedDecl *D) { in VisitNamedDecl() argument
253 VisitDeclContext(D->getDeclContext()); in VisitNamedDecl()
256 if (EmitDeclName(D)) { in VisitNamedDecl()
265 void USRGenerator::VisitVarDecl(const VarDecl *D) { in VisitVarDecl() argument
269 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitVarDecl()
272 VisitDeclContext(D->getDeclContext()); in VisitVarDecl()
275 StringRef s = D->getName(); in VisitVarDecl()
288 const NonTypeTemplateParmDecl *D) { in VisitNonTypeTemplateParmDecl() argument
289 GenLoc(D, /*IncludeOffset=*/true); in VisitNonTypeTemplateParmDecl()
294 const TemplateTemplateParmDecl *D) { in VisitTemplateTemplateParmDecl() argument
295 GenLoc(D, /*IncludeOffset=*/true); in VisitTemplateTemplateParmDecl()
299 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) { in VisitNamespaceDecl() argument
300 if (D->isAnonymousNamespace()) { in VisitNamespaceDecl()
305 VisitDeclContext(D->getDeclContext()); in VisitNamespaceDecl()
307 Out << "@N@" << D->getName(); in VisitNamespaceDecl()
310 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { in VisitFunctionTemplateDecl() argument
311 VisitFunctionDecl(D->getTemplatedDecl()); in VisitFunctionTemplateDecl()
314 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) { in VisitClassTemplateDecl() argument
315 VisitTagDecl(D->getTemplatedDecl()); in VisitClassTemplateDecl()
318 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) { in VisitNamespaceAliasDecl() argument
319 VisitDeclContext(D->getDeclContext()); in VisitNamespaceAliasDecl()
321 Out << "@NA@" << D->getName(); in VisitNamespaceAliasDecl()
324 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { in VisitObjCMethodDecl() argument
325 const DeclContext *container = D->getDeclContext(); in VisitObjCMethodDecl()
332 const ObjCInterfaceDecl *ID = D->getClassInterface(); in VisitObjCMethodDecl()
342 Out << (D->isInstanceMethod() ? "(im)" : "(cm)") in VisitObjCMethodDecl()
343 << DeclarationName(D->getSelector()); in VisitObjCMethodDecl()
346 void USRGenerator::VisitObjCContainerDecl(const ObjCContainerDecl *D) { in VisitObjCContainerDecl() argument
347 switch (D->getKind()) { in VisitObjCContainerDecl()
352 GenObjCClass(D->getName()); in VisitObjCContainerDecl()
355 const ObjCCategoryDecl *CD = cast<ObjCCategoryDecl>(D); in VisitObjCContainerDecl()
377 const ObjCCategoryImplDecl *CD = cast<ObjCCategoryImplDecl>(D); in VisitObjCContainerDecl()
391 GenObjCProtocol(cast<ObjCProtocolDecl>(D)->getName()); in VisitObjCContainerDecl()
396 void USRGenerator::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) { in VisitObjCPropertyDecl() argument
399 if (const ObjCInterfaceDecl *ID = Context->getObjContainingInterface(D)) in VisitObjCPropertyDecl()
402 Visit(cast<Decl>(D->getDeclContext())); in VisitObjCPropertyDecl()
403 GenObjCProperty(D->getName()); in VisitObjCPropertyDecl()
406 void USRGenerator::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) { in VisitObjCPropertyImplDecl() argument
407 if (ObjCPropertyDecl *PD = D->getPropertyDecl()) { in VisitObjCPropertyImplDecl()
415 void USRGenerator::VisitTagDecl(const TagDecl *D) { in VisitTagDecl() argument
418 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitTagDecl()
421 D = D->getCanonicalDecl(); in VisitTagDecl()
422 VisitDeclContext(D->getDeclContext()); in VisitTagDecl()
425 if (const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) { in VisitTagDecl()
429 switch (D->getTagKind()) { in VisitTagDecl()
441 switch (D->getTagKind()) { in VisitTagDecl()
453 switch (D->getTagKind()) { in VisitTagDecl()
466 if (EmitDeclName(D)) { in VisitTagDecl()
467 if (const TypedefNameDecl *TD = D->getTypedefNameForAnonDecl()) { in VisitTagDecl()
472 if (D->isEmbeddedInDeclarator() && !D->isFreeStanding()) { in VisitTagDecl()
473 printLoc(Out, D->getLocation(), Context->getSourceManager(), true); in VisitTagDecl()
481 = dyn_cast<ClassTemplateSpecializationDecl>(D)) { in VisitTagDecl()
491 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) { in VisitTypedefDecl() argument
492 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D))) in VisitTypedefDecl()
494 const DeclContext *DC = D->getDeclContext(); in VisitTypedefDecl()
498 Out << D->getName(); in VisitTypedefDecl()
501 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { in VisitTemplateTypeParmDecl() argument
502 GenLoc(D, /*IncludeOffset=*/true); in VisitTemplateTypeParmDecl()
506 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) { in GenLoc() argument
512 if (!D) { in GenLoc()
518 D = D->getCanonicalDecl(); in GenLoc()
521 IgnoreResults || printLoc(Out, D->getLocStart(), in GenLoc()
846 bool clang::index::generateUSRForDecl(const Decl *D, in generateUSRForDecl() argument
849 if (!D || D->getLocStart().isInvalid()) in generateUSRForDecl()
852 USRGenerator UG(&D->getASTContext(), Buf); in generateUSRForDecl()
853 UG.Visit(D); in generateUSRForDecl()