[Lldb-commits] [lldb] [lldb][DebugNames] Only skip processing of DW_AT_declarations for cla… (PR #94400)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 4 13:57:27 PDT 2024


https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/94400

…ss/union types

This is a follow-up of https://github.com/llvm/llvm-project/pull/92328#issuecomment-2145849441

Clang attaches `DW_AT_declaration` to static inline data members and `dsymutil` indexes these constants. Skipping these caused the expression evaluator to fail to find such constants when using DWARFv5.

Fixes `TestConstStaticIntegralMember.py` on DWARFv5.

>From ddf20047e2868eed14c9691d72eb4c45ac582840 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Tue, 4 Jun 2024 21:52:26 +0100
Subject: [PATCH] [lldb][DebugNames] Only skip processing of DW_AT_declarations
 for class/union types

This is a follow-up of https://github.com/llvm/llvm-project/pull/92328#issuecomment-2145849441

Clang attaches `DW_AT_declaration` to static inline data members
and `dsymutil` indexes these constants. Skipping these caused
the expression evaluator to fail to find such constants when
using DWARFv5.

Fixes `TestConstStaticIntegralMember.py` on DWARFv5.
---
 lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 56717bab1ecd8..6330470b970e7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -87,7 +87,8 @@ bool DebugNamesDWARFIndex::ProcessEntry(
     return true;
   // Clang erroneously emits index entries for declaration DIEs in case when the
   // definition is in a type unit (llvm.org/pr77696). Weed those out.
-  if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0))
+  if (die.IsStructUnionOrClass() &&
+      die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0))
     return true;
   return callback(die);
 }



More information about the lldb-commits mailing list