void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
void dumpTemplateParameters(const TemplateParameterList *TPL);
void dumpTemplateArgumentListInfo(const TemplateArgumentListInfo &TALI);
- void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A);
+ void dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
+ const Decl *From = nullptr,
+ const char *label = nullptr);
void dumpTemplateArgumentList(const TemplateArgumentList &TAL);
void dumpTemplateArgument(const TemplateArgument &A,
- SourceRange R = SourceRange());
+ SourceRange R = SourceRange(),
+ const Decl *From = nullptr,
+ const char *label = nullptr);
template <typename SpecializationDecl>
void dumpTemplateDeclSpecialization(const SpecializationDecl *D,
bool DumpExplicitInst,
dumpTemplateArgumentLoc(TALI[i]);
}
-void ASTDumper::dumpTemplateArgumentLoc(const TemplateArgumentLoc &A) {
- dumpTemplateArgument(A.getArgument(), A.getSourceRange());
+void ASTDumper::dumpTemplateArgumentLoc(const TemplateArgumentLoc &A,
+ const Decl *From, const char *label) {
+ dumpTemplateArgument(A.getArgument(), A.getSourceRange(), From, label);
}
void ASTDumper::dumpTemplateArgumentList(const TemplateArgumentList &TAL) {
dumpTemplateArgument(TAL[i]);
}
-void ASTDumper::dumpTemplateArgument(const TemplateArgument &A, SourceRange R) {
+void ASTDumper::dumpTemplateArgument(const TemplateArgument &A, SourceRange R,
+ const Decl *From, const char *label) {
dumpChild([=] {
OS << "TemplateArgument";
if (R.isValid())
NodeDumper.dumpSourceRange(R);
+ if (From) {
+ dumpDeclRef(From, label);
+ }
+
switch (A.getKind()) {
case TemplateArgument::Null:
OS << " null";
OS << " ...";
NodeDumper.dumpName(D);
if (D->hasDefaultArgument())
- dumpTemplateArgument(D->getDefaultArgument());
- if (auto *From = D->getDefaultArgStorage().getInheritedFrom())
- dumpDeclRef(From, D->defaultArgumentWasInherited() ? "inherited from"
- : "previous");
+ dumpTemplateArgument(D->getDefaultArgument(), SourceRange(),
+ D->getDefaultArgStorage().getInheritedFrom(),
+ D->defaultArgumentWasInherited() ? "inherited from"
+ : "previous");
}
void ASTDumper::VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
OS << " ...";
NodeDumper.dumpName(D);
if (D->hasDefaultArgument())
- dumpTemplateArgument(D->getDefaultArgument());
- if (auto *From = D->getDefaultArgStorage().getInheritedFrom())
- dumpDeclRef(From, D->defaultArgumentWasInherited() ? "inherited from"
- : "previous");
+ dumpTemplateArgument(D->getDefaultArgument(), SourceRange(),
+ D->getDefaultArgStorage().getInheritedFrom(),
+ D->defaultArgumentWasInherited() ? "inherited from"
+ : "previous");
}
void ASTDumper::VisitTemplateTemplateParmDecl(
NodeDumper.dumpName(D);
dumpTemplateParameters(D->getTemplateParameters());
if (D->hasDefaultArgument())
- dumpTemplateArgumentLoc(D->getDefaultArgument());
- if (auto *From = D->getDefaultArgStorage().getInheritedFrom())
- dumpDeclRef(From, D->defaultArgumentWasInherited() ? "inherited from"
- : "previous");
+ dumpTemplateArgumentLoc(
+ D->getDefaultArgument(), D->getDefaultArgStorage().getInheritedFrom(),
+ D->defaultArgumentWasInherited() ? "inherited from" : "previous");
}
void ASTDumper::VisitUsingDecl(const UsingDecl *D) {
// CHECK: ClassTemplateDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} {{.*}} TestTemplateDefaultType\r
// CHECK-NEXT: TemplateTypeParmDecl\r
// CHECK-NEXT: TemplateArgument type 'int'\r
-// CHECK-NEXT: inherited from TemplateTypeParm 0x{{[^ ]*}} 'T'\r
+// CHECK-NEXT: inherited from TemplateTypeParm 0x{{[^ ]*}} 'T'\r
\r
// CHECK: ClassTemplateDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} {{.*}} TestTemplateDefaultNonType\r
// CHECK-NEXT: NonTypeTemplateParmDecl\r
// CHECK-NEXT: TemplateArgument expr\r
+// CHECK-NEXT: inherited from NonTypeTemplateParm 0x{{[^ ]*}} 'I' 'int'\r
// CHECK-NEXT: ConstantExpr\r
// CHECK-NEXT: IntegerLiteral\r
-// CHECK-NEXT: inherited from NonTypeTemplateParm 0x{{[^ ]*}} 'I' 'int'\r
\r
// CHECK: ClassTemplateDecl 0x{{[^ ]*}} prev 0x{{[^ ]*}} {{.*}} TestTemplateTemplateDefaultType\r
// CHECK-NEXT: TemplateTemplateParmDecl\r
// CHECK-NEXT: TemplateTypeParmDecl\r
// CHECK-NEXT: TemplateArgument\r
-// CHECK-NEXT: inherited from TemplateTemplateParm 0x{{[^ ]*}} 'TT'\r
+// CHECK-NEXT: inherited from TemplateTemplateParm 0x{{[^ ]*}} 'TT'\r
\r
// PR15220 dump instantiation only once\r
namespace testCanonicalTemplate {\r