Skip to content

Commit 01b1863

Browse files
committed
debug
1 parent 2222f7b commit 01b1863

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

clang/lib/AST/ASTImporter.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,9 +1661,32 @@ ExpectedType ASTNodeImporter::VisitTemplateSpecializationType(
16611661
ImportTemplateArguments(T->template_arguments(), ToTemplateArgs))
16621662
return std::move(Err);
16631663

1664-
if (T->isCanonicalUnqualified())
1664+
if (T->isCanonicalUnqualified()) {
1665+
auto reportNoncanonicalArgument = [](const ASTContext &C,
1666+
ArrayRef<TemplateArgument> Args,
1667+
std::string_view Str) {
1668+
for (const auto &Arg : Args) {
1669+
TemplateArgument Canon = C.getCanonicalTemplateArgument(Arg);
1670+
if (Arg.structurallyEquals(Canon))
1671+
continue;
1672+
llvm::errs() << "non-canonical pos:" << (&Arg - Args.begin()) << ' '
1673+
<< Str << '\n';
1674+
Arg.dump(llvm::errs(), C);
1675+
llvm::errs() << "canonical:\n";
1676+
Canon.dump(llvm::errs(), C);
1677+
return true;
1678+
}
1679+
return false;
1680+
};
1681+
if (reportNoncanonicalArgument(Importer.getFromContext(),
1682+
T->template_arguments(), "From") ||
1683+
reportNoncanonicalArgument(Importer.getToContext(), ToTemplateArgs,
1684+
"To"))
1685+
T->dump(llvm::errs(), Importer.getFromContext());
1686+
16651687
return Importer.getToContext().getCanonicalTemplateSpecializationType(
16661688
*ToTemplateOrErr, ToTemplateArgs);
1689+
}
16671690

16681691
ExpectedType ToUnderlyingOrErr = import(T->desugar());
16691692
if (!ToUnderlyingOrErr)

0 commit comments

Comments
 (0)