This is an archive of the discontinued LLVM Phabricator instance.

[clang][AST] Set correct DeclContext in ASTImporter lookup table for ParmVarDecl.
ClosedPublic

Authored by balazske on May 27 2021, 2:32 AM.

Details

Summary

ParmVarDecl is created with translation unit as the parent DeclContext
and later moved to the correct DeclContext. ASTImporterLookupTable
should be updated at this move.

Diff Detail

Event Timeline

balazske created this revision.May 27 2021, 2:32 AM
balazske requested review of this revision.May 27 2021, 2:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2021, 2:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
martong accepted this revision.May 27 2021, 6:59 AM

Thanks, looks good to me, with a nit in the tests.

clang/unittests/AST/ASTImporterTest.cpp
6233

Instead of .empty(), perhaps we should examine if the found entry is indeed the imported ParmVarDecl.

This revision is now accepted and ready to land.May 27 2021, 6:59 AM
balazske updated this revision to Diff 349496.Jun 3 2021, 2:30 AM
balazske marked an inline comment as done.

Added contains for correct check of ASTImporterLookupTable content.

Added contains for correct check of ASTImporterLookupTable content.

Okay, that looks good, but I just realized we should not have "bare" assertions. Could you please add some explanatory textual description for the new assertions?

clang/lib/AST/ASTImporterLookupTable.cpp
121

Could you please add some explanatory textual description for the new assertions?

balazske updated this revision to Diff 349583.Jun 3 2021, 9:18 AM

Added assert messages.

martong accepted this revision.Jun 3 2021, 12:24 PM

Thanks!