Page MenuHomePhabricator

[ASTImporter] Friend class decl should not be visible in its context

Authored by martong on Dec 4 2019, 8:17 AM.



In the past we had to use DeclContext::makeDeclVisibleInContext to make
friend declarations available for subsequent lookup calls and this way
we could chain (redecl) the structurally equivalent decls.
By doing this we created an AST that improperly made declarations
visible in some contexts, so the AST was malformed.
Since we use the importer specific lookup this is no longer necessary,
because with that we can find every previous nodes.

Diff Detail

Event Timeline

martong created this revision.Dec 4 2019, 8:17 AM
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

Hi Gabor,
This patch looks mostly good to me. Thanks!




Why don't we use getCanonicalType() anymore?

martong updated this revision to Diff 233675.Dec 12 2019, 1:25 PM
martong marked 4 inline comments as done.

Addressing Alexeis comments.


Thanks! Good catch.


Thanks, that is a very good catch.

Hi Gabor,
I have an inline comment for the patch. Otherwise, looks good.


I wonder if ElaboratedType can be a canonical type because it is only a sugar type itself. Do we need to handle this case?

martong updated this revision to Diff 234062.Dec 16 2019, 7:43 AM
martong marked an inline comment as done.

Simplify getRecordDeclOfFriend() further.

martong marked an inline comment as done.Dec 16 2019, 7:43 AM
martong added inline comments.

You are right, I removed this case. Thanks!

a_sidorin accepted this revision.Dec 16 2019, 1:17 PM

LGTM, thanks!

This revision is now accepted and ready to land.Dec 16 2019, 1:17 PM
This revision was automatically updated to reflect the committed changes.

Looks like this breaks building on Windows in general:

Recommited in bc5b7e21e32 . I changed llvm:is_contained to a simple for loop over the lookup result. This way the copy assignment of the iterator is avoided even if windows STL is used.