Page MenuHomePhabricator

Call setMustBuildLookupTable on TagDecls in ExternalASTMerger
ClosedPublic

Authored by lhames on Jun 15 2017, 3:17 PM.

Details

Summary

setMustBuildLookupTable should be called on imported TagDecls otherwise we may fail
to import their member decls (if they have any).

Not calling the setMustBuildLookupTable method results in a failure in the attached test
case when lookup for the 'x' member fails on struct S, which hasn't had its decls imported
elsewhere. (By contrast the member-in-struct testcase hasn't run into this issue
because the import of its decls is triggered when the struct instance is defined, and the
member access follows this).

Event Timeline

lhames created this revision.Jun 15 2017, 3:17 PM
lhames set the repository for this revision to rL LLVM.Jun 15 2017, 3:19 PM
spyffe accepted this revision.Jun 16 2017, 10:09 AM

Thanks for the test. This looks fine.

This revision is now accepted and ready to land.Jun 16 2017, 10:09 AM
rsmith accepted this revision.Jun 16 2017, 10:13 AM

If the lookup table is expected to be computed from the lexical decls rather than provided via "external visible storage", this makes sense to me.

If the lookup table is expected to be computed from the lexical decls rather than provided via "external visible storage", this makes sense to me.

This gets in to details that I'm (very) fuzzy on. My understanding is that external lexical storage should be set on DeclContexts whose child decls are enumerable up front (e.g. class member decls), and that external visible storage was for open DeclContexts like namespaces. Based on that, I assumed a TagDecl (which, if I understand correctly, is either a Record or an Enum) would always have external lexical storage, never external visible storage. Is that right?

Anticipating that it may be useful to you in answering this, my favorite Charles Babbage quote is: "I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."

lhames closed this revision.Jun 16 2017, 5:13 PM