================
@@ -2306,6 +2345,11 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const 
DWARFDIE &die,
 
   if (!die)
     return false;
+  ParsedDWARFTypeAttributes attrs(die);
----------------
ZequanWu wrote:

> Why don't those cases lead to a crash? For example, what would happen if the 
> name was simply not in the index?

That is specific to debug_names because the index gives us a declaration DIE 
when we are searching for definition DIE in 
'FindDefinitionTypeForDWARFDeclContext'. Before, we didn't have the extra 
check, so we tries to complete the type from declaration DIE, which triggers an 
assertion in clang. However, it doesn't happen in manual index because we 
already explicitly checked `DW_AT_declaration` attributes when creating the 
manual index. It's guaranteed to find a definition DIE from 
`FindDefinitionTypeForDWARFDeclContext` or nothing (early bailout, won't try to 
complete it).

> So it seems perfectly reasonable to have this check somewhere. I just want to 
> check whether this is the right place.

I assume Greg's change at https://github.com/llvm/llvm-project/pull/91808 will 
also fix this problem by skipping forward declaration DIE when processing it, 
which is earlier check  than this extra check added here.

https://github.com/llvm/llvm-project/pull/92328
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to