This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Make ClangASTImporter::LayoutRecordType always return the same layout
Needs ReviewPublic

Authored by teemperor on Dec 17 2019, 5:20 AM.

Details

Reviewers
shafik
a.sidorin
Summary

ClangASTImporter::LayoutRecordType provides record layouts for Clang to use during CodeGen.

Currently this method only provides a layout once and then deletes the layout from the internal
storage. The next time we get a request for the same record layout we pretend that we don't know
the record and leave CodeGen on its own to produce the layout. This system currently seems to work as we
usually request a layout over an ASTContext which caches the result, so the ClangASTImporter
will most likely never be asked twice to layout a record unless the ASTContext changes at some
point.

I think it makes sense that we do not rely on the caching mechanism in the ASTContext to save
us from doing the wrong thing and instead always return the same layout from ClangASTContext.
Also marks the method as const because it is essentially just a getter now.

Diff Detail