This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix a UsingTemplate regression after 3e78fa860235431323aaf08c8fa922d75a7cfffa
ClosedPublic

Authored by hokein on Mar 16 2023, 2:20 AM.

Details

Summary

TemplateName::getAsTemplateDecl() returns the underlying TemplateDecl
for a UsingTemplate kind template name. We should respect that in the
Profile method otherwise we might desugar the template name unexpectedly
(e.g. for template argument deduction with deduciton guides).

Diff Detail

Event Timeline

hokein created this revision.Mar 16 2023, 2:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 16 2023, 2:20 AM
hokein requested review of this revision.Mar 16 2023, 2:20 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 16 2023, 2:20 AM
kadircet accepted this revision.Mar 16 2023, 2:50 AM
kadircet added a subscriber: ChuanqiXu.

FWIW, I believe this patch does the right thing by marking the DeducedTemplateSpecializationType as using. It's explicitly introduced into the global namespace through the using decl, and even before 3e78fa860235431323aaf08c8fa922d75a7cfffa we weren't marking them as such.

But I am still not sure about the implications of this in the modules world. So adding @ChuanqiXu as a reviewer in case he has more insights.

This revision is now accepted and ready to land.Mar 16 2023, 2:50 AM
ChuanqiXu accepted this revision.Mar 16 2023, 3:22 AM

Yeah, this one should be correct. Modules techniques use *::Profile method to judge if two entities are the same extensively. So it would be best to add a test case for modules like we did in https://reviews.llvm.org/rG3e78fa860235431323aaf08c8fa922d75a7cfffa. And it doesn't matter if you are not interested, I'll take it later then.

Thanks for the review.

Yeah, this one should be correct. Modules techniques use *::Profile method to judge if two entities are the same extensively. So it would be best to add a test case for modules like we did in https://reviews.llvm.org/rG3e78fa860235431323aaf08c8fa922d75a7cfffa. And it doesn't matter if you are not interested, I'll take it later then.

I'm landing the patch as-is now. It would be nice for you to add a related test for modules afterwards (since I don't have much knowledge about clang module stuff).

This revision was landed with ongoing or failed builds.Mar 16 2023, 4:59 AM
This revision was automatically updated to reflect the committed changes.