Lines Matching refs:D
48 void VisitTranslationUnitDecl(TranslationUnitDecl *D);
49 void VisitTypedefDecl(TypedefDecl *D);
50 void VisitTypeAliasDecl(TypeAliasDecl *D);
51 void VisitEnumDecl(EnumDecl *D);
52 void VisitRecordDecl(RecordDecl *D);
53 void VisitEnumConstantDecl(EnumConstantDecl *D);
54 void VisitEmptyDecl(EmptyDecl *D);
55 void VisitFunctionDecl(FunctionDecl *D);
56 void VisitFriendDecl(FriendDecl *D);
57 void VisitFieldDecl(FieldDecl *D);
58 void VisitVarDecl(VarDecl *D);
59 void VisitLabelDecl(LabelDecl *D);
60 void VisitParmVarDecl(ParmVarDecl *D);
61 void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
62 void VisitImportDecl(ImportDecl *D);
63 void VisitStaticAssertDecl(StaticAssertDecl *D);
64 void VisitNamespaceDecl(NamespaceDecl *D);
65 void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
66 void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
67 void VisitCXXRecordDecl(CXXRecordDecl *D);
68 void VisitLinkageSpecDecl(LinkageSpecDecl *D);
69 void VisitTemplateDecl(const TemplateDecl *D);
70 void VisitFunctionTemplateDecl(FunctionTemplateDecl *D);
71 void VisitClassTemplateDecl(ClassTemplateDecl *D);
72 void VisitObjCMethodDecl(ObjCMethodDecl *D);
73 void VisitObjCImplementationDecl(ObjCImplementationDecl *D);
74 void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
75 void VisitObjCProtocolDecl(ObjCProtocolDecl *D);
76 void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D);
77 void VisitObjCCategoryDecl(ObjCCategoryDecl *D);
78 void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D);
79 void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
80 void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
81 void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
82 void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
83 void VisitUsingDecl(UsingDecl *D);
84 void VisitUsingShadowDecl(UsingShadowDecl *D);
85 void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
89 void prettyPrintAttributes(Decl *D);
128 static QualType getDeclType(Decl* D) { in getDeclType() argument
129 if (TypedefNameDecl* TDD = dyn_cast<TypedefNameDecl>(D)) in getDeclType()
131 if (ValueDecl* VD = dyn_cast<ValueDecl>(D)) in getDeclType()
187 void DeclPrinter::prettyPrintAttributes(Decl *D) { in prettyPrintAttributes() argument
191 if (D->hasAttrs()) { in prettyPrintAttributes()
192 AttrVec &Attrs = D->getAttrs(); in prettyPrintAttributes()
229 for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end(); in VisitDeclContext() local
230 D != DEnd; ++D) { in VisitDeclContext()
234 if (isa<ObjCIvarDecl>(*D)) in VisitDeclContext()
238 if (D->isImplicit()) in VisitDeclContext()
249 QualType CurDeclType = getDeclType(*D); in VisitDeclContext()
256 Decls.push_back(*D); in VisitDeclContext()
267 if (isa<TagDecl>(*D) && !cast<TagDecl>(*D)->getIdentifier()) { in VisitDeclContext()
268 Decls.push_back(*D); in VisitDeclContext()
272 if (isa<AccessSpecDecl>(*D)) { in VisitDeclContext()
275 Print(D->getAccess()); in VisitDeclContext()
282 Visit(*D); in VisitDeclContext()
286 if (isa<OMPThreadPrivateDecl>(*D)) in VisitDeclContext()
288 else if (isa<FunctionDecl>(*D) && in VisitDeclContext()
289 cast<FunctionDecl>(*D)->isThisDeclarationADefinition()) in VisitDeclContext()
291 else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->getBody()) in VisitDeclContext()
293 else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) || in VisitDeclContext()
294 isa<ObjCImplementationDecl>(*D) || in VisitDeclContext()
295 isa<ObjCInterfaceDecl>(*D) || in VisitDeclContext()
296 isa<ObjCProtocolDecl>(*D) || in VisitDeclContext()
297 isa<ObjCCategoryImplDecl>(*D) || in VisitDeclContext()
298 isa<ObjCCategoryDecl>(*D)) in VisitDeclContext()
300 else if (isa<EnumConstantDecl>(*D)) { in VisitDeclContext()
301 DeclContext::decl_iterator Next = D; in VisitDeclContext()
320 void DeclPrinter::VisitTranslationUnitDecl(TranslationUnitDecl *D) { in VisitTranslationUnitDecl() argument
321 VisitDeclContext(D, false); in VisitTranslationUnitDecl()
324 void DeclPrinter::VisitTypedefDecl(TypedefDecl *D) { in VisitTypedefDecl() argument
328 if (D->isModulePrivate()) in VisitTypedefDecl()
331 D->getTypeSourceInfo()->getType().print(Out, Policy, D->getName()); in VisitTypedefDecl()
332 prettyPrintAttributes(D); in VisitTypedefDecl()
335 void DeclPrinter::VisitTypeAliasDecl(TypeAliasDecl *D) { in VisitTypeAliasDecl() argument
336 Out << "using " << *D; in VisitTypeAliasDecl()
337 prettyPrintAttributes(D); in VisitTypeAliasDecl()
338 Out << " = " << D->getTypeSourceInfo()->getType().getAsString(Policy); in VisitTypeAliasDecl()
341 void DeclPrinter::VisitEnumDecl(EnumDecl *D) { in VisitEnumDecl() argument
342 if (!Policy.SuppressSpecifiers && D->isModulePrivate()) in VisitEnumDecl()
345 if (D->isScoped()) { in VisitEnumDecl()
346 if (D->isScopedUsingClassTag()) in VisitEnumDecl()
351 Out << *D; in VisitEnumDecl()
353 if (D->isFixed()) in VisitEnumDecl()
354 Out << " : " << D->getIntegerType().stream(Policy); in VisitEnumDecl()
356 if (D->isCompleteDefinition()) { in VisitEnumDecl()
358 VisitDeclContext(D); in VisitEnumDecl()
361 prettyPrintAttributes(D); in VisitEnumDecl()
364 void DeclPrinter::VisitRecordDecl(RecordDecl *D) { in VisitRecordDecl() argument
365 if (!Policy.SuppressSpecifiers && D->isModulePrivate()) in VisitRecordDecl()
367 Out << D->getKindName(); in VisitRecordDecl()
368 if (D->getIdentifier()) in VisitRecordDecl()
369 Out << ' ' << *D; in VisitRecordDecl()
371 if (D->isCompleteDefinition()) { in VisitRecordDecl()
373 VisitDeclContext(D); in VisitRecordDecl()
378 void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) { in VisitEnumConstantDecl() argument
379 Out << *D; in VisitEnumConstantDecl()
380 if (Expr *Init = D->getInitExpr()) { in VisitEnumConstantDecl()
386 void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { in VisitFunctionDecl() argument
387 CXXConstructorDecl *CDecl = dyn_cast<CXXConstructorDecl>(D); in VisitFunctionDecl()
388 CXXConversionDecl *ConversionDecl = dyn_cast<CXXConversionDecl>(D); in VisitFunctionDecl()
390 switch (D->getStorageClass()) { in VisitFunctionDecl()
399 if (D->isInlineSpecified()) Out << "inline "; in VisitFunctionDecl()
400 if (D->isVirtualAsWritten()) Out << "virtual "; in VisitFunctionDecl()
401 if (D->isModulePrivate()) Out << "__module_private__ "; in VisitFunctionDecl()
402 if (D->isConstexpr() && !D->isExplicitlyDefaulted()) Out << "constexpr "; in VisitFunctionDecl()
410 std::string Proto = D->getNameInfo().getAsString(); in VisitFunctionDecl()
412 QualType Ty = D->getType(); in VisitFunctionDecl()
420 if (D->hasWrittenPrototype()) in VisitFunctionDecl()
427 for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) { in VisitFunctionDecl()
429 ParamPrinter.VisitParmVarDecl(D->getParamDecl(i)); in VisitFunctionDecl()
433 if (D->getNumParams()) POut << ", "; in VisitFunctionDecl()
436 } else if (D->doesThisDeclarationHaveABody() && !D->hasPrototype()) { in VisitFunctionDecl()
437 for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) { in VisitFunctionDecl()
440 Proto += D->getParamDecl(i)->getNameAsString(); in VisitFunctionDecl()
553 } else if (!ConversionDecl && !isa<CXXDestructorDecl>(D)) { in VisitFunctionDecl()
566 prettyPrintAttributes(D); in VisitFunctionDecl()
568 if (D->isPure()) in VisitFunctionDecl()
570 else if (D->isDeletedAsWritten()) in VisitFunctionDecl()
572 else if (D->isExplicitlyDefaulted()) in VisitFunctionDecl()
574 else if (D->doesThisDeclarationHaveABody() && !Policy.TerseOutput) { in VisitFunctionDecl()
575 if (!D->hasPrototype() && D->getNumParams()) { in VisitFunctionDecl()
581 for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) { in VisitFunctionDecl()
583 ParamPrinter.VisitParmVarDecl(D->getParamDecl(i)); in VisitFunctionDecl()
590 if (D->getBody()) in VisitFunctionDecl()
591 D->getBody()->printPretty(Out, nullptr, SubPolicy, Indentation); in VisitFunctionDecl()
596 void DeclPrinter::VisitFriendDecl(FriendDecl *D) { in VisitFriendDecl() argument
597 if (TypeSourceInfo *TSI = D->getFriendType()) { in VisitFriendDecl()
598 unsigned NumTPLists = D->getFriendTypeNumTemplateParameterLists(); in VisitFriendDecl()
600 PrintTemplateParameters(D->getFriendTypeTemplateParameterList(i)); in VisitFriendDecl()
605 dyn_cast<FunctionDecl>(D->getFriendDecl())) { in VisitFriendDecl()
610 dyn_cast<FunctionTemplateDecl>(D->getFriendDecl())) { in VisitFriendDecl()
615 dyn_cast<ClassTemplateDecl>(D->getFriendDecl())) { in VisitFriendDecl()
621 void DeclPrinter::VisitFieldDecl(FieldDecl *D) { in VisitFieldDecl() argument
622 if (!Policy.SuppressSpecifiers && D->isMutable()) in VisitFieldDecl()
624 if (!Policy.SuppressSpecifiers && D->isModulePrivate()) in VisitFieldDecl()
627 Out << D->getASTContext().getUnqualifiedObjCPointerType(D->getType()). in VisitFieldDecl()
628 stream(Policy, D->getName()); in VisitFieldDecl()
630 if (D->isBitField()) { in VisitFieldDecl()
632 D->getBitWidth()->printPretty(Out, nullptr, Policy, Indentation); in VisitFieldDecl()
635 Expr *Init = D->getInClassInitializer(); in VisitFieldDecl()
637 if (D->getInClassInitStyle() == ICIS_ListInit) in VisitFieldDecl()
643 prettyPrintAttributes(D); in VisitFieldDecl()
646 void DeclPrinter::VisitLabelDecl(LabelDecl *D) { in VisitLabelDecl() argument
647 Out << *D << ":"; in VisitLabelDecl()
651 void DeclPrinter::VisitVarDecl(VarDecl *D) { in VisitVarDecl() argument
653 StorageClass SC = D->getStorageClass(); in VisitVarDecl()
657 switch (D->getTSCSpec()) { in VisitVarDecl()
671 if (D->isModulePrivate()) in VisitVarDecl()
675 QualType T = D->getTypeSourceInfo() in VisitVarDecl()
676 ? D->getTypeSourceInfo()->getType() in VisitVarDecl()
677 : D->getASTContext().getUnqualifiedObjCPointerType(D->getType()); in VisitVarDecl()
678 T.print(Out, Policy, D->getName()); in VisitVarDecl()
679 Expr *Init = D->getInit(); in VisitVarDecl()
684 if (D->getInitStyle() == VarDecl::CallInit && in VisitVarDecl()
691 if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init)) in VisitVarDecl()
693 else if (D->getInitStyle() == VarDecl::CInit) { in VisitVarDecl()
697 if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init)) in VisitVarDecl()
701 prettyPrintAttributes(D); in VisitVarDecl()
704 void DeclPrinter::VisitParmVarDecl(ParmVarDecl *D) { in VisitParmVarDecl() argument
705 VisitVarDecl(D); in VisitParmVarDecl()
708 void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) { in VisitFileScopeAsmDecl() argument
710 D->getAsmString()->printPretty(Out, nullptr, Policy, Indentation); in VisitFileScopeAsmDecl()
714 void DeclPrinter::VisitImportDecl(ImportDecl *D) { in VisitImportDecl() argument
715 Out << "@import " << D->getImportedModule()->getFullModuleName() in VisitImportDecl()
719 void DeclPrinter::VisitStaticAssertDecl(StaticAssertDecl *D) { in VisitStaticAssertDecl() argument
721 D->getAssertExpr()->printPretty(Out, nullptr, Policy, Indentation); in VisitStaticAssertDecl()
723 D->getMessage()->printPretty(Out, nullptr, Policy, Indentation); in VisitStaticAssertDecl()
730 void DeclPrinter::VisitNamespaceDecl(NamespaceDecl *D) { in VisitNamespaceDecl() argument
731 if (D->isInline()) in VisitNamespaceDecl()
733 Out << "namespace " << *D << " {\n"; in VisitNamespaceDecl()
734 VisitDeclContext(D); in VisitNamespaceDecl()
738 void DeclPrinter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) { in VisitUsingDirectiveDecl() argument
740 if (D->getQualifier()) in VisitUsingDirectiveDecl()
741 D->getQualifier()->print(Out, Policy); in VisitUsingDirectiveDecl()
742 Out << *D->getNominatedNamespaceAsWritten(); in VisitUsingDirectiveDecl()
745 void DeclPrinter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) { in VisitNamespaceAliasDecl() argument
746 Out << "namespace " << *D << " = "; in VisitNamespaceAliasDecl()
747 if (D->getQualifier()) in VisitNamespaceAliasDecl()
748 D->getQualifier()->print(Out, Policy); in VisitNamespaceAliasDecl()
749 Out << *D->getAliasedNamespace(); in VisitNamespaceAliasDecl()
752 void DeclPrinter::VisitEmptyDecl(EmptyDecl *D) { in VisitEmptyDecl() argument
753 prettyPrintAttributes(D); in VisitEmptyDecl()
756 void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) { in VisitCXXRecordDecl() argument
757 if (!Policy.SuppressSpecifiers && D->isModulePrivate()) in VisitCXXRecordDecl()
759 Out << D->getKindName(); in VisitCXXRecordDecl()
760 if (D->getIdentifier()) in VisitCXXRecordDecl()
761 Out << ' ' << *D; in VisitCXXRecordDecl()
763 if (D->isCompleteDefinition()) { in VisitCXXRecordDecl()
765 if (D->getNumBases()) { in VisitCXXRecordDecl()
767 for (CXXRecordDecl::base_class_iterator Base = D->bases_begin(), in VisitCXXRecordDecl()
768 BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) { in VisitCXXRecordDecl()
769 if (Base != D->bases_begin()) in VisitCXXRecordDecl()
788 VisitDeclContext(D); in VisitCXXRecordDecl()
793 void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) { in VisitLinkageSpecDecl() argument
795 if (D->getLanguage() == LinkageSpecDecl::lang_c) in VisitLinkageSpecDecl()
798 assert(D->getLanguage() == LinkageSpecDecl::lang_cxx && in VisitLinkageSpecDecl()
804 if (D->hasBraces()) { in VisitLinkageSpecDecl()
806 VisitDeclContext(D); in VisitLinkageSpecDecl()
809 Visit(*D->decls_begin()); in VisitLinkageSpecDecl()
874 void DeclPrinter::VisitTemplateDecl(const TemplateDecl *D) { in VisitTemplateDecl() argument
875 PrintTemplateParameters(D->getTemplateParameters()); in VisitTemplateDecl()
878 dyn_cast<TemplateTemplateParmDecl>(D)) { in VisitTemplateDecl()
882 Out << D->getName(); in VisitTemplateDecl()
884 Visit(D->getTemplatedDecl()); in VisitTemplateDecl()
888 void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { in VisitFunctionTemplateDecl() argument
890 TemplateParameterList *Params = D->getTemplateParameters(); in VisitFunctionTemplateDecl()
891 for (auto *I : D->specializations()) { in VisitFunctionTemplateDecl()
897 return VisitRedeclarableTemplateDecl(D); in VisitFunctionTemplateDecl()
900 void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) { in VisitClassTemplateDecl() argument
902 TemplateParameterList *Params = D->getTemplateParameters(); in VisitClassTemplateDecl()
903 for (auto *I : D->specializations()) { in VisitClassTemplateDecl()
910 return VisitRedeclarableTemplateDecl(D); in VisitClassTemplateDecl()
1158 void DeclPrinter::VisitUsingDecl(UsingDecl *D) { in VisitUsingDecl() argument
1159 if (!D->isAccessDeclaration()) in VisitUsingDecl()
1161 if (D->hasTypename()) in VisitUsingDecl()
1163 D->getQualifier()->print(Out, Policy); in VisitUsingDecl()
1164 Out << *D; in VisitUsingDecl()
1168 DeclPrinter::VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D) { in VisitUnresolvedUsingTypenameDecl() argument
1170 D->getQualifier()->print(Out, Policy); in VisitUnresolvedUsingTypenameDecl()
1171 Out << D->getDeclName(); in VisitUnresolvedUsingTypenameDecl()
1174 void DeclPrinter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) { in VisitUnresolvedUsingValueDecl() argument
1175 if (!D->isAccessDeclaration()) in VisitUnresolvedUsingValueDecl()
1177 D->getQualifier()->print(Out, Policy); in VisitUnresolvedUsingValueDecl()
1178 Out << D->getName(); in VisitUnresolvedUsingValueDecl()
1181 void DeclPrinter::VisitUsingShadowDecl(UsingShadowDecl *D) { in VisitUsingShadowDecl() argument
1185 void DeclPrinter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) { in VisitOMPThreadPrivateDecl() argument
1187 if (!D->varlist_empty()) { in VisitOMPThreadPrivateDecl()
1188 for (OMPThreadPrivateDecl::varlist_iterator I = D->varlist_begin(), in VisitOMPThreadPrivateDecl()
1189 E = D->varlist_end(); in VisitOMPThreadPrivateDecl()
1191 Out << (I == D->varlist_begin() ? '(' : ','); in VisitOMPThreadPrivateDecl()