[Lldb-commits] [PATCH] D78000: [ASTImporter] Fix handling of not defined FromRecord in ImportContext(...)
Gabor Marton via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 20 02:39:10 PDT 2020
martong added a comment.
Thanks for the test Shafik, that is pretty self explanatory!
================
Comment at: clang/lib/AST/ASTImporter.cpp:8161
if (auto *ToRecord = dyn_cast<RecordDecl>(ToDC)) {
auto *FromRecord = cast<RecordDecl>(FromDC);
if (ToRecord->isCompleteDefinition()) {
----------------
What if we did this a bit differently? We could simply complete the From type if it is not completed, before getting into `ImportDefinition`.
```
if (ToRecord->isCompleteDefinition())
return ToDC;
auto *FromRecord = cast<RecordDecl>(FromDC);
if (FromRecord->hasExternalLexicalStorage() &&
!FromRecord->isCompleteDefinition())
FromRecord->getASTContext().getExternalSource()->CompleteType(
FromRecord);
```
This way we could get rid of the redundant calls of `ImportDefinition`. As we have now a call for the case when we don't have external storage and for the case when we have.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78000/new/
https://reviews.llvm.org/D78000
More information about the lldb-commits
mailing list