Skip to content

[lldb] Regularize DWARFDIE::Get{TypeLookup,Decl}Context names #122273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

labath
Copy link
Collaborator

@labath labath commented Jan 9, 2025

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.

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.
@labath labath requested a review from Michael137 January 9, 2025 13:24
@labath labath requested a review from JDevlieghere as a code owner January 9, 2025 13:24
@llvmbot llvmbot added the lldb label Jan 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 9, 2025

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/122273.diff

1 Files Affected:

  • (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (+2-2)
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());

@labath labath merged commit 05dfbc1 into llvm:main Jan 10, 2025
9 checks passed
@labath labath deleted the pubname branch January 10, 2025 08:50
BaiXilin pushed a commit to BaiXilin/llvm-fix-vnni-instr-types that referenced this pull request Jan 12, 2025
…22273)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants