================
@@ -375,16 +375,21 @@ std::vector<DWARFDIE> DWARFDIE::GetDeclContextDIEs() 
const {
 
 std::vector<lldb_private::CompilerContext> DWARFDIE::GetDeclContext() const {
   std::vector<lldb_private::CompilerContext> context;
-  const dw_tag_t tag = Tag();
-  if (tag == DW_TAG_compile_unit || tag == DW_TAG_partial_unit)
-    return context;
   DWARFDIE parent = GetParent();
-  if (parent)
+  if (parent) {
+    const dw_tag_t parent_tag = parent.Tag();
+    if (parent_tag == DW_TAG_compile_unit || parent_tag == DW_TAG_partial_unit)
----------------
adrian-prantl wrote:

In theory a DWARF producer could produce any structure. Clang and Swift only 
produce this form. I was trying to come up with a very simple cycle detection 
here. My thinking was that if the parent is the CU and the specification isn't 
the current DIE this is not a cycle, but thinking about it again, there still 
could be a larger cycle. I'll rework this to use a visited set.

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

Reply via email to