This is an archive of the discontinued LLVM Phabricator instance.

[AST] Check described template at structural equivalence check.
ClosedPublic

Authored by balazske on Jul 12 2018, 2:01 AM.

Details

Summary

When checking a class or function the described class or function template
is checked too.
Improved test with symmetric check, added new tests.

Diff Detail

Repository
rC Clang

Event Timeline

balazske created this revision.Jul 12 2018, 2:01 AM
Eugene.Zelenko added a project: Restricted Project.
martong accepted this revision.Jul 27 2018, 9:08 AM

LGTM.

This revision is now accepted and ready to land.Jul 27 2018, 9:08 AM
a_sidorin added inline comments.Aug 1 2018, 7:28 AM
lib/AST/ASTStructuralEquivalence.cpp
1025

I think we can move the changes for both RecordDecl and FunctionDecl into Finish() and use Decl::getDescribedTemplate(). This will both simplify the patch and give us the support for templated VarDecls and TypeAliasDecls for free. What do you think?

balazske added inline comments.Aug 1 2018, 7:59 AM
lib/AST/ASTStructuralEquivalence.cpp
1025

Yes it can be good to check with getDescribedClassTemplate in Finish. (Similarly, there can be more things that are common to check with all Decl or NamedDecl objects in Finish, specifically the name is checked. Or in some cases the name does not matter, but in others yes?)

a_sidorin added inline comments.Aug 3 2018, 3:17 PM
lib/AST/ASTStructuralEquivalence.cpp
1025

I think that name always matters for structure equivalence checking. I cannot remember any case where it was false during development of our PoC.

balazske updated this revision to Diff 159279.Aug 6 2018, 5:25 AM
  • Rebase, common checks at ASTStructuralEquivalenceContext
a.sidorin accepted this revision.Aug 6 2018, 10:21 AM

Hi Balazs,
I have only two nits. Otherwise, the patch is OK and can be committed without additional approval after the comments are fixed. Thank you!

lib/AST/ASTStructuralEquivalence.cpp
1500

CheckCommonEquivalence/CheckKindSpecificEquivalence?

1643–1644

Equivalent = CommonCheckAtFinish(D1, D2) && SpecialCheckAtFinish(D1, D2))?

balazske updated this revision to Diff 159458.Aug 7 2018, 12:31 AM
balazske marked an inline comment as done.
  • Renamed methods, simplified code, comments updated.
balazske marked 3 inline comments as done.Aug 7 2018, 12:39 AM
This revision was automatically updated to reflect the committed changes.