@@ -278,8 +278,8 @@ static void PrepareContextToReceiveMembers(TypeSystemClang &ast,
278
278
// we can complete the type by doing a full import.
279
279
280
280
// If this type was not imported from an external AST, there's nothing to do.
281
+ CompilerType type = ast.GetTypeForDecl (tag_decl_ctx);
281
282
if (ast_importer.CanImport (tag_decl_ctx)) {
282
- CompilerType type = ast.GetTypeForDecl (tag_decl_ctx);
283
283
auto qual_type = ClangUtil::GetQualType (type);
284
284
if (ast_importer.RequireCompleteType (qual_type))
285
285
return ;
@@ -290,8 +290,15 @@ static void PrepareContextToReceiveMembers(TypeSystemClang &ast,
290
290
}
291
291
292
292
// We don't have a type definition and/or the import failed, but we need to
293
- // add members to it. Start the definition to make that possible.
294
- tag_decl_ctx->startDefinition ();
293
+ // add members to it. Start the definition to make that possible. If the type
294
+ // has no external storage we also have to complete the definition. Otherwise,
295
+ // that will happen when we are asked to complete the type
296
+ // (CompleteTypeFromDWARF).
297
+ ast.StartTagDeclarationDefinition (type);
298
+ if (!tag_decl_ctx->hasExternalLexicalStorage ()) {
299
+ ast.SetDeclIsForcefullyCompleted (tag_decl_ctx);
300
+ ast.CompleteTagDeclarationDefinition (type);
301
+ }
295
302
}
296
303
297
304
void DWARFASTParserClang::RegisterDIE (DWARFDebugInfoEntry *die,
0 commit comments