Lines Matching defs:D
62 void VisitTranslationUnitDecl(TranslationUnitDecl *D);
63 void VisitTypedefDecl(TypedefDecl *D);
64 void VisitTypeAliasDecl(TypeAliasDecl *D);
65 void VisitEnumDecl(EnumDecl *D);
66 void VisitRecordDecl(RecordDecl *D);
67 void VisitEnumConstantDecl(EnumConstantDecl *D);
68 void VisitEmptyDecl(EmptyDecl *D);
69 void VisitFunctionDecl(FunctionDecl *D);
70 void VisitFriendDecl(FriendDecl *D);
71 void VisitFieldDecl(FieldDecl *D);
72 void VisitVarDecl(VarDecl *D);
73 void VisitLabelDecl(LabelDecl *D);
74 void VisitParmVarDecl(ParmVarDecl *D);
75 void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
76 void VisitTopLevelStmtDecl(TopLevelStmtDecl *D);
77 void VisitImportDecl(ImportDecl *D);
78 void VisitStaticAssertDecl(StaticAssertDecl *D);
79 void VisitNamespaceDecl(NamespaceDecl *D);
80 void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
81 void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
82 void VisitCXXRecordDecl(CXXRecordDecl *D);
83 void VisitLinkageSpecDecl(LinkageSpecDecl *D);
84 void VisitTemplateDecl(const TemplateDecl *D);
85 void VisitFunctionTemplateDecl(FunctionTemplateDecl *D);
86 void VisitClassTemplateDecl(ClassTemplateDecl *D);
88 ClassTemplateSpecializationDecl *D);
90 ClassTemplatePartialSpecializationDecl *D);
91 void VisitObjCMethodDecl(ObjCMethodDecl *D);
92 void VisitObjCImplementationDecl(ObjCImplementationDecl *D);
93 void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
94 void VisitObjCProtocolDecl(ObjCProtocolDecl *D);
95 void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D);
96 void VisitObjCCategoryDecl(ObjCCategoryDecl *D);
97 void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D);
98 void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
99 void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
100 void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
101 void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
102 void VisitUsingDecl(UsingDecl *D);
103 void VisitUsingEnumDecl(UsingEnumDecl *D);
104 void VisitUsingShadowDecl(UsingShadowDecl *D);
105 void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
106 void VisitOMPAllocateDecl(OMPAllocateDecl *D);
107 void VisitOMPRequiresDecl(OMPRequiresDecl *D);
108 void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
109 void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D);
110 void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D);
113 void VisitHLSLBufferDecl(HLSLBufferDecl *D);
123 prettyPrintAttributes(const Decl *D,
125 void prettyPrintPragmas(Decl *D);
184 static QualType getDeclType(Decl* D) {
185 if (TypedefNameDecl* TDD = dyn_cast<TypedefNameDecl>(D))
187 if (ValueDecl* VD = dyn_cast<ValueDecl>(D))
242 const Decl *D) {
244 SourceLocation DLoc = D->getLocation();
245 const ASTContext &C = D->getASTContext();
256 bool DeclPrinter::prettyPrintAttributes(const Decl *D,
260 if (D->hasAttrs()) {
261 const AttrVec &Attrs = D->getAttrs();
274 AttrPosAsWritten APos = getPosAsWritten(A, D);
292 void DeclPrinter::prettyPrintPragmas(Decl *D) {
296 if (D->hasAttrs()) {
297 AttrVec &Attrs = D->getAttrs();
428 for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end();
429 D != DEnd; ++D) {
433 if (isa<ObjCIvarDecl>(*D))
437 if (D->isImplicit())
442 if (auto FD = dyn_cast<FunctionDecl>(*D))
459 QualType CurDeclType = getDeclType(*D);
464 Decls.push_back(*D);
475 if (isa<TagDecl>(*D) && !cast<TagDecl>(*D)->isFreeStanding()) {
476 Decls.push_back(*D);
480 if (isa<AccessSpecDecl>(*D)) {
483 Print(D->getAccess());
490 Visit(*D);
494 if (isa<OMPThreadPrivateDecl>(*D) || isa<OMPDeclareReductionDecl>(*D) ||
495 isa<OMPDeclareMapperDecl>(*D) || isa<OMPRequiresDecl>(*D) ||
496 isa<OMPAllocateDecl>(*D))
498 else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->hasBody())
500 else if (auto FD = dyn_cast<FunctionDecl>(*D)) {
505 } else if (auto TD = dyn_cast<FunctionTemplateDecl>(*D)) {
512 ObjCCategoryDecl, HLSLBufferDecl>(*D))
514 else if (isa<EnumConstantDecl>(*D)) {
515 DeclContext::decl_iterator Next = D;
525 ((isa<FunctionDecl>(*D) &&
526 cast<FunctionDecl>(*D)->doesThisDeclarationHaveABody()) ||
527 (isa<FunctionTemplateDecl>(*D) &&
528 cast<FunctionTemplateDecl>(*D)->getTemplatedDecl()->doesThisDeclarationHaveABody())))
535 if (D->hasAttr<OMPDeclareTargetDeclAttr>())
546 void DeclPrinter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
547 VisitDeclContext(D, false);
550 void DeclPrinter::VisitTypedefDecl(TypedefDecl *D) {
554 if (D->isModulePrivate())
557 QualType Ty = D->getTypeSourceInfo()->getType();
558 Ty.print(Out, Policy, D->getName(), Indentation);
559 prettyPrintAttributes(D);
562 void DeclPrinter::VisitTypeAliasDecl(TypeAliasDecl *D) {
563 Out << "using " << *D;
564 prettyPrintAttributes(D);
565 Out << " = " << D->getTypeSourceInfo()->getType().getAsString(Policy);
568 void DeclPrinter::VisitEnumDecl(EnumDecl *D) {
569 if (!Policy.SuppressSpecifiers && D->isModulePrivate())
572 if (D->isScoped()) {
573 if (D->isScopedUsingClassTag())
579 prettyPrintAttributes(D);
581 if (D->getDeclName())
582 Out << ' ' << D->getDeclName();
584 if (D->isFixed())
585 Out << " : " << D->getIntegerType().stream(Policy);
587 if (D->isCompleteDefinition()) {
589 VisitDeclContext(D);
594 void DeclPrinter::VisitRecordDecl(RecordDecl *D) {
595 if (!Policy.SuppressSpecifiers && D->isModulePrivate())
597 Out << D->getKindName();
599 prettyPrintAttributes(D);
601 if (D->getIdentifier())
602 Out << ' ' << *D;
604 if (D->isCompleteDefinition()) {
606 VisitDeclContext(D);
611 void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
612 Out << *D;
613 prettyPrintAttributes(D);
614 if (Expr *Init = D->getInitExpr()) {
646 void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
647 if (!D->getDescribedFunctionTemplate() &&
648 !D->isFunctionTemplateSpecialization()) {
649 prettyPrintPragmas(D);
650 prettyPrintAttributes(D, AttrPosAsWritten::Left);
653 if (D->isFunctionTemplateSpecialization())
655 else if (!D->getDescribedFunctionTemplate()) {
656 for (unsigned I = 0, NumTemplateParams = D->getNumTemplateParameterLists();
658 printTemplateParameters(D->getTemplateParameterList(I));
661 CXXConstructorDecl *CDecl = dyn_cast<CXXConstructorDecl>(D);
662 CXXConversionDecl *ConversionDecl = dyn_cast<CXXConversionDecl>(D);
663 CXXDeductionGuideDecl *GuideDecl = dyn_cast<CXXDeductionGuideDecl>(D);
665 switch (D->getStorageClass()) {
674 if (D->isInlineSpecified()) Out << "inline ";
675 if (D->isVirtualAsWritten()) Out << "virtual ";
676 if (D->isModulePrivate()) Out << "__module_private__ ";
677 if (D->isConstexprSpecified() && !D->isExplicitlyDefaulted())
679 if (D->isConsteval()) Out << "consteval ";
680 else if (D->isImmediateFunction())
682 ExplicitSpecifier ExplicitSpec = ExplicitSpecifier::getFromDecl(D);
692 Proto += D->getQualifiedNameAsString();
696 if (const NestedNameSpecifier *NS = D->getQualifier()) {
700 D->getNameInfo().printName(OS, Policy);
705 if (D->isFunctionTemplateSpecialization()) {
708 const auto *TArgAsWritten = D->getTemplateSpecializationArgsAsWritten();
712 D->getTemplateSpecializationArgs())
716 QualType Ty = D->getType();
724 if (D->hasWrittenPrototype())
731 for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
733 ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
737 if (D->getNumParams()) POut << ", ";
739 } else if (!D->getNumParams() && !Context.getLangOpts().CPlusPlus) {
744 } else if (D->doesThisDeclarationHaveABody() && !D->hasPrototype()) {
745 for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
748 Proto += D->getParamDecl(i)->getNameAsString();
801 } else if (!ConversionDecl && !isa<CXXDestructorDecl>(D)) {
817 if (Expr *TrailingRequiresClause = D->getTrailingRequiresClause()) {
826 prettyPrintAttributes(D, AttrPosAsWritten::Right);
828 if (D->isPureVirtual())
830 else if (D->isDeletedAsWritten()) {
832 if (const StringLiteral *M = D->getDeletedMessage()) {
837 } else if (D->isExplicitlyDefaulted())
839 else if (D->doesThisDeclarationHaveABody()) {
841 if (!D->hasPrototype() && D->getNumParams()) {
847 for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
849 ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
855 if (D->getBody())
856 D->getBody()->printPrettyControlled(Out, nullptr, SubPolicy, Indentation, "\n",
859 if (!Policy.TerseOutput && isa<CXXConstructorDecl>(*D))
865 void DeclPrinter::VisitFriendDecl(FriendDecl *D) {
866 if (TypeSourceInfo *TSI = D->getFriendType()) {
867 unsigned NumTPLists = D->getFriendTypeNumTemplateParameterLists();
869 printTemplateParameters(D->getFriendTypeTemplateParameterList(i));
874 dyn_cast<FunctionDecl>(D->getFriendDecl())) {
879 dyn_cast<FunctionTemplateDecl>(D->getFriendDecl())) {
884 dyn_cast<ClassTemplateDecl>(D->getFriendDecl())) {
890 void DeclPrinter::VisitFieldDecl(FieldDecl *D) {
892 if (!Policy.SuppressSpecifiers && D->isMutable())
894 if (!Policy.SuppressSpecifiers && D->isModulePrivate())
897 Out << D->getASTContext().getUnqualifiedObjCPointerType(D->getType()).
898 stream(Policy, D->getName(), Indentation);
900 if (D->isBitField()) {
902 D->getBitWidth()->printPretty(Out, nullptr, Policy, Indentation, "\n",
906 Expr *Init = D->getInClassInitializer();
908 if (D->getInClassInitStyle() == ICIS_ListInit)
914 prettyPrintAttributes(D);
917 void DeclPrinter::VisitLabelDecl(LabelDecl *D) {
918 Out << *D << ":";
921 void DeclPrinter::VisitVarDecl(VarDecl *D) {
922 prettyPrintPragmas(D);
924 prettyPrintAttributes(D, AttrPosAsWritten::Left);
926 if (const auto *Param = dyn_cast<ParmVarDecl>(D);
930 QualType T = D->getTypeSourceInfo()
931 ? D->getTypeSourceInfo()->getType()
932 : D->getASTContext().getUnqualifiedObjCPointerType(D->getType());
935 StorageClass SC = D->getStorageClass();
939 switch (D->getTSCSpec()) {
953 if (D->isModulePrivate())
956 if (D->isConstexpr()) {
966 printDeclType(T, (isa<ParmVarDecl>(D) && Policy.CleanUglifiedParameters &&
967 D->getIdentifier())
968 ? D->getIdentifier()->deuglifiedName()
969 : D->getName());
971 prettyPrintAttributes(D, AttrPosAsWritten::Right);
973 Expr *Init = D->getInit();
976 if (D->isCXXForRangeDecl()) {
981 if (D->getInitStyle() == VarDecl::CallInit &&
988 if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init))
990 else if (D->getInitStyle() == VarDecl::CInit) {
997 if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init))
1003 void DeclPrinter::VisitParmVarDecl(ParmVarDecl *D) {
1004 VisitVarDecl(D);
1007 void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
1009 D->getAsmString()->printPretty(Out, nullptr, Policy, Indentation, "\n",
1014 void DeclPrinter::VisitTopLevelStmtDecl(TopLevelStmtDecl *D) {
1015 assert(D->getStmt());
1016 D->getStmt()->printPretty(Out, nullptr, Policy, Indentation, "\n", &Context);
1019 void DeclPrinter::VisitImportDecl(ImportDecl *D) {
1020 Out << "@import " << D->getImportedModule()->getFullModuleName()
1024 void DeclPrinter::VisitStaticAssertDecl(StaticAssertDecl *D) {
1026 D->getAssertExpr()->printPretty(Out, nullptr, Policy, Indentation, "\n",
1028 if (Expr *E = D->getMessage()) {
1038 void DeclPrinter::VisitNamespaceDecl(NamespaceDecl *D) {
1039 if (D->isInline())
1043 if (D->getDeclName())
1044 Out << D->getDeclName() << ' ';
1047 VisitDeclContext(D);
1051 void DeclPrinter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
1053 if (D->getQualifier())
1054 D->getQualifier()->print(Out, Policy);
1055 Out << *D->getNominatedNamespaceAsWritten();
1058 void DeclPrinter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
1059 Out << "namespace " << *D << " = ";
1060 if (D->getQualifier())
1061 D->getQualifier()->print(Out, Policy);
1062 Out << *D->getAliasedNamespace();
1065 void DeclPrinter::VisitEmptyDecl(EmptyDecl *D) {
1066 prettyPrintAttributes(D);
1069 void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
1071 if (!Policy.SuppressSpecifiers && D->isModulePrivate())
1074 Out << D->getKindName() << ' ';
1078 if (prettyPrintAttributes(D, AttrPosAsWritten::Left))
1081 if (D->getIdentifier()) {
1082 if (auto *NNS = D->getQualifier())
1084 Out << *D;
1086 if (auto *S = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
1098 prettyPrintAttributes(D, AttrPosAsWritten::Right);
1100 if (D->isCompleteDefinition()) {
1103 if (D->getNumBases()) {
1105 for (CXXRecordDecl::base_class_iterator Base = D->bases_begin(),
1106 BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) {
1107 if (Base != D->bases_begin())
1132 VisitDeclContext(D);
1138 void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
1140 if (D->getLanguage() == LinkageSpecLanguageIDs::C)
1143 assert(D->getLanguage() == LinkageSpecLanguageIDs::CXX &&
1149 if (D->hasBraces()) {
1151 VisitDeclContext(D);
1154 Visit(*D->decls_begin());
1234 void DeclPrinter::VisitTemplateDecl(const TemplateDecl *D) {
1235 printTemplateParameters(D->getTemplateParameters());
1238 dyn_cast<TemplateTemplateParmDecl>(D)) {
1255 } else if (auto *TD = D->getTemplatedDecl())
1257 else if (const auto *Concept = dyn_cast<ConceptDecl>(D)) {
1264 void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
1265 prettyPrintPragmas(D->getTemplatedDecl());
1267 if (const FunctionDecl *FD = D->getTemplatedDecl()) {
1272 VisitRedeclarableTemplateDecl(D);
1275 if (D->getTemplatedDecl()->hasAttr<OMPDeclareTargetDeclAttr>())
1281 !isa<CXXDeductionGuideDecl>(D->getTemplatedDecl())) {
1282 FunctionDecl *PrevDecl = D->getTemplatedDecl();
1286 for (auto *I : D->specializations())
1297 void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
1298 VisitRedeclarableTemplateDecl(D);
1301 for (auto *I : D->specializations())
1303 if (D->isThisDeclarationADefinition())
1313 ClassTemplateSpecializationDecl *D) {
1315 VisitCXXRecordDecl(D);
1319 ClassTemplatePartialSpecializationDecl *D) {
1320 printTemplateParameters(D->getTemplateParameters());
1321 VisitCXXRecordDecl(D);
1710 void DeclPrinter::VisitUsingDecl(UsingDecl *D) {
1711 if (!D->isAccessDeclaration())
1713 if (D->hasTypename())
1715 D->getQualifier()->print(Out, Policy);
1719 for (const auto *Shadow : D->shadows()) {
1727 Out << *D;
1730 void DeclPrinter::VisitUsingEnumDecl(UsingEnumDecl *D) {
1731 Out << "using enum " << D->getEnumDecl();
1735 DeclPrinter::VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D) {
1737 D->getQualifier()->print(Out, Policy);
1738 Out << D->getDeclName();
1741 void DeclPrinter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
1742 if (!D->isAccessDeclaration())
1744 D->getQualifier()->print(Out, Policy);
1745 Out << D->getDeclName();
1748 void DeclPrinter::VisitUsingShadowDecl(UsingShadowDecl *D) {
1752 void DeclPrinter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
1754 if (!D->varlist_empty()) {
1755 for (OMPThreadPrivateDecl::varlist_iterator I = D->varlist_begin(),
1756 E = D->varlist_end();
1758 Out << (I == D->varlist_begin() ? '(' : ',');
1766 void DeclPrinter::VisitHLSLBufferDecl(HLSLBufferDecl *D) {
1767 if (D->isCBuffer())
1772 Out << *D;
1774 prettyPrintAttributes(D);
1777 VisitDeclContext(D);
1781 void DeclPrinter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
1783 if (!D->varlist_empty()) {
1784 for (OMPAllocateDecl::varlist_iterator I = D->varlist_begin(),
1785 E = D->varlist_end();
1787 Out << (I == D->varlist_begin() ? '(' : ',');
1793 if (!D->clauselist_empty()) {
1795 for (OMPClause *C : D->clauselists()) {
1802 void DeclPrinter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {
1804 if (!D->clauselist_empty()) {
1806 for (auto I = D->clauselist_begin(), E = D->clauselist_end(); I != E; ++I)
1811 void DeclPrinter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
1812 if (!D->isInvalidDecl()) {
1814 if (D->getDeclName().getNameKind() == DeclarationName::CXXOperatorName) {
1816 getOperatorSpelling(D->getDeclName().getCXXOverloadedOperator());
1820 assert(D->getDeclName().isIdentifier());
1821 D->printName(Out, Policy);
1824 D->getType().print(Out, Policy);
1826 D->getCombiner()->printPretty(Out, nullptr, Policy, 0, "\n", &Context);
1828 if (auto *Init = D->getInitializer()) {
1830 switch (D->getInitializerKind()) {
1841 if (D->getInitializerKind() == OMPDeclareReductionInitKind::Direct)
1848 void DeclPrinter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
1849 if (!D->isInvalidDecl()) {
1851 D->printName(Out, Policy);
1853 D->getType().print(Out, Policy);
1855 Out << D->getVarName();
1857 if (!D->clauselist_empty()) {
1859 for (auto *C : D->clauselists()) {
1867 void DeclPrinter::VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D) {
1868 D->getInit()->printPretty(Out, nullptr, Policy, Indentation, "\n", &Context);