[Lldb-commits] [lldb] [lldb][DWARF] Do not complete type from declaration die. (PR #91799)

Zequan Wu via lldb-commits lldb-commits at lists.llvm.org
Fri May 10 13:39:06 PDT 2024


https://github.com/ZequanWu updated https://github.com/llvm/llvm-project/pull/91799

>From 1f6bf890dbfce07b6ab531597e876ab83cfd1298 Mon Sep 17 00:00:00 2001
From: Zequan Wu <zequanwu at google.com>
Date: Fri, 10 May 2024 16:00:22 -0400
Subject: [PATCH 1/2] [lldb][DWARF] Do not complete type from declaration die.

---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index e0b1b430b266f..315ba4cc0ccdf 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2343,7 +2343,10 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
   // clang::ExternalASTSource queries for this type.
   m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), false);
 
-  if (!die)
+  ParsedDWARFTypeAttributes attrs(die);
+  bool is_forward_declaration = IsForwardDeclaration(
+      die, attrs, SymbolFileDWARF::GetLanguage(*die.GetCU()));
+  if (!die || is_forward_declaration)
     return false;
 
   const dw_tag_t tag = die.Tag();

>From 3e2791d99be0a21351ee4bf57beaf2c30ba5256e Mon Sep 17 00:00:00 2001
From: Zequan Wu <zequanwu at google.com>
Date: Fri, 10 May 2024 16:38:54 -0400
Subject: [PATCH 2/2] address comment

---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 315ba4cc0ccdf..2a46be9216121 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2343,10 +2343,12 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
   // clang::ExternalASTSource queries for this type.
   m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), false);
 
+  if (!die)
+    return false;
   ParsedDWARFTypeAttributes attrs(die);
   bool is_forward_declaration = IsForwardDeclaration(
       die, attrs, SymbolFileDWARF::GetLanguage(*die.GetCU()));
-  if (!die || is_forward_declaration)
+  if (is_forward_declaration)
     return false;
 
   const dw_tag_t tag = die.Tag();



More information about the lldb-commits mailing list