[Lldb-commits] [lldb] [lldb] Regularize DWARFDIE::Get{TypeLookup, Decl}Context names (PR #122273)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 9 05:24:39 PST 2025


https://github.com/labath created https://github.com/llvm/llvm-project/pull/122273

The functions call GetName for everything except variables, where they call GetPubname instead. The difference is that the latter prefers to return the linkage name, if it is available.

This doesn't seem particularly useful given that the linkage name already kind of contains the context of the variable, and I doubt that anything depends on it as these functions are currently called on type and subprogram DIEs -- not variables.

This makes it easier to simplify/deduplicate these functions later.

>From c65e70faf378998a53a5ad645dbae2353bf251a5 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Thu, 9 Jan 2025 14:18:39 +0100
Subject: [PATCH] [lldb] Regularize DWARFDIE::Get{TypeLookup,Decl}Context names

The functions call GetName for everything except variables, where they
call GetPubname instead. The difference is that the latter prefers to
return the linkage name, if it is available.

This doesn't seem particularly useful given that the linkage name
already kind of contains the context of the variable, and I doubt that
anything depends on it as these functions are currently called on type
and subprogram DIEs -- not variables.

This makes it easier to simplify/deduplicate these functions later.
---
 lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index 96b13efe583513..4b864b549f8ce6 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -412,7 +412,7 @@ static void GetDeclContextImpl(DWARFDIE die,
       push_ctx(CompilerContextKind::Function, die.GetName());
       break;
     case DW_TAG_variable:
-      push_ctx(CompilerContextKind::Variable, die.GetPubname());
+      push_ctx(CompilerContextKind::Variable, die.GetName());
       break;
     case DW_TAG_typedef:
       push_ctx(CompilerContextKind::Typedef, die.GetName());
@@ -457,7 +457,7 @@ static void GetTypeLookupContextImpl(DWARFDIE die,
       push_ctx(CompilerContextKind::Enum, die.GetName());
       break;
     case DW_TAG_variable:
-      push_ctx(CompilerContextKind::Variable, die.GetPubname());
+      push_ctx(CompilerContextKind::Variable, die.GetName());
       break;
     case DW_TAG_typedef:
       push_ctx(CompilerContextKind::Typedef, die.GetName());



More information about the lldb-commits mailing list