This is an archive of the discontinued LLVM Phabricator instance.

[ASTImporter] Import implicit methods of existing class.
ClosedPublic

Authored by balazske on Jul 12 2018, 8:41 AM.

Details

Summary

When an already existing class is encountered during import,
check if it has implicit methods that are missing in the existing one,
and import these.
The to-be-imported code may use the same class in different way than the
existing (before the import) code. This may result in that there are
implicit methods that are not generated for the existing code.

Diff Detail

Event Timeline

balazske created this revision.Jul 12 2018, 8:41 AM
a_sidorin accepted this revision.Jul 14 2018, 10:41 PM
a_sidorin added a subscriber: a_sidorin.

LGTM. Just some stylish nits.
To resolve this issue, I used Sema::DeclareImplicit... methods. But I like this approach much more because it doesn't allows to forget different kinds of implicit methods and doesn't require passing Sema into ASTImporter.

lib/AST/ASTImporter.cpp
2203

... because implicit methods are created only if they are used.

unittests/AST/ASTImporterTest.cpp
2302

/*ExpectedCount=*/. Same below.

2305

clang-format places a space before the template parameter list.

This revision is now accepted and ready to land.Jul 14 2018, 10:41 PM
balazske updated this revision to Diff 155625.Jul 16 2018, 12:31 AM
  • Small style and comment changes.
balazske marked 3 inline comments as done.Jul 16 2018, 12:33 AM
This revision was automatically updated to reflect the committed changes.