This is an archive of the discontinued LLVM Phabricator instance.

[ASTImporter] Fix unhandled cases in ASTImporterLookupTable
ClosedPublic

Authored by martong on May 17 2019, 7:19 AM.

Details

Summary

In most cases the FriendDecl contains the declaration of the befriended
class as a child node, so it is discovered during the recursive
visitation. However, there are cases when the befriended class is not a
child, thus it must be fetched explicitly from the FriendDecl, and only
then can we add it to the lookup table.
(Note, this does affect only CTU and does not affect LLDB, because we
cannot and do not use the ASTImporterLookupTable in LLDB.)

Diff Detail

Repository
rL LLVM

Event Timeline

martong created this revision.May 17 2019, 7:19 AM
Herald added a reviewer: shafik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript

Hi Gabor,
This looks fine, but I have a question inline.

clang/unittests/AST/ASTImporterTest.cpp
4259 ↗(On Diff #200043)

Will getCanonicalType() do the job?

martong marked 2 inline comments as done.May 21 2019, 2:35 AM
martong added inline comments.
clang/unittests/AST/ASTImporterTest.cpp
4259 ↗(On Diff #200043)

That's a good catch! Thank you for pointing out.

martong updated this revision to Diff 200435.May 21 2019, 2:35 AM
martong marked an inline comment as done.
  • Remove getUnderlyingType
a_sidorin accepted this revision.May 26 2019, 10:11 AM
a_sidorin added inline comments.
clang/unittests/AST/ASTImporterTest.cpp
4249 ↗(On Diff #200435)

Redundant space after '*'.

4259 ↗(On Diff #200043)

Can we replace the whole function with:

QualType Ty = FD->getFriendType()->getType().getCanonicalType();
return cast<RecordType>(Ty)->getDecl();

?

This revision is now accepted and ready to land.May 26 2019, 10:11 AM
martong marked 3 inline comments as done.Jun 11 2019, 6:25 AM
martong added inline comments.
clang/unittests/AST/ASTImporterTest.cpp
4259 ↗(On Diff #200043)

Thank you, this is indeed simpler, changed that.

martong updated this revision to Diff 204048.Jun 11 2019, 6:25 AM
martong marked an inline comment as done.
  • Simplify getRecordDeclOfFriend
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2019, 6:32 AM