@@ -633,21 +633,26 @@ DIE *DwarfUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
633633
634634void DwarfUnit::updateAcceleratorTables (const DIScope *Context,
635635 const DIType *Ty, const DIE &TyDIE) {
636- if (!Ty->getName ().empty () && !Ty->isForwardDecl ()) {
637- bool IsImplementation = false ;
638- if (auto *CT = dyn_cast<DICompositeType>(Ty)) {
639- // A runtime language of 0 actually means C/C++ and that any
640- // non-negative value is some version of Objective-C/C++.
641- IsImplementation = CT->getRuntimeLang () == 0 || CT->isObjcClassComplete ();
642- }
643- unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0 ;
644- DD->addAccelType (*this , CUNode->getNameTableKind (), Ty->getName (), TyDIE,
645- Flags);
636+ if (Ty->getName ().empty ())
637+ return ;
638+ if (Ty->isForwardDecl ())
639+ return ;
646640
647- if (!Context || isa<DICompileUnit>(Context) || isa<DIFile>(Context) ||
648- isa<DINamespace>(Context) || isa<DICommonBlock>(Context))
649- addGlobalType (Ty, TyDIE, Context);
641+ // add temporary record for this type to be added later
642+
643+ bool IsImplementation = false ;
644+ if (auto *CT = dyn_cast<DICompositeType>(Ty)) {
645+ // A runtime language of 0 actually means C/C++ and that any
646+ // non-negative value is some version of Objective-C/C++.
647+ IsImplementation = CT->getRuntimeLang () == 0 || CT->isObjcClassComplete ();
650648 }
649+ unsigned Flags = IsImplementation ? dwarf::DW_FLAG_type_implementation : 0 ;
650+ DD->addAccelType (*this , CUNode->getNameTableKind (), Ty->getName (), TyDIE,
651+ Flags);
652+
653+ if (!Context || isa<DICompileUnit>(Context) || isa<DIFile>(Context) ||
654+ isa<DINamespace>(Context) || isa<DICommonBlock>(Context))
655+ addGlobalType (Ty, TyDIE, Context);
651656}
652657
653658void DwarfUnit::addType (DIE &Entity, const DIType *Ty,
0 commit comments