This is an archive of the discontinued LLVM Phabricator instance.

[lldb][tests][gmodules] Test for expression evaluator crash for types that reference same template class
ClosedPublic

Authored by Michael137 on Sep 15 2022, 8:03 AM.

Details

Summary

The problem here is that the ASTImporter adds
the template base class member FieldDecl to
the DeclContext twice. This happens because
we don't construct a LookupPtr for decls
that originate from modules and thus the
ASTImporter never realizes that the FieldDecl
has already been imported. These duplicate
decls then break the assumption of the LayoutBuilder
which expects only a single member decl to
exist.

The test will be fixed by a follow-up revision
and is thus skipped for now.

Diff Detail

Event Timeline

Michael137 created this revision.Sep 15 2022, 8:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 8:03 AM
Herald added a subscriber: rnkovacs. · View Herald Transcript
Michael137 requested review of this revision.Sep 15 2022, 8:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 15 2022, 8:03 AM
  • Add check on structure of AST in API test
martong accepted this revision.Sep 16 2022, 12:40 AM

Looks good to me!

lldb/test/API/lang/cpp/gmodules/base-template-with-same-arg/module1.h
8

I was wondering whether you would have the crash if you used the directly the base class? I.e. if you had the ClassInMod3Base<int> VecInMod1 here and ClassInMod3Base<int> VecInMod2 in the other module.

This revision is now accepted and ready to land.Sep 16 2022, 12:40 AM
Michael137 added inline comments.Sep 16 2022, 5:13 AM
lldb/test/API/lang/cpp/gmodules/base-template-with-same-arg/module1.h
8

Very true! Will reduce it down further, thanks

  • Reduce test further
  • Separate check on decl structure into new function
Michael137 retitled this revision from [lldb][tests][gmodules] Test for expression evaluator crash for types with template base class to [lldb][tests][gmodules] Test for expression evaluator crash for types that reference same template class.Sep 16 2022, 6:17 AM