[Lldb-commits] [lldb] [lldb][Language] Simplify SourceLanguage::GetDescription (PR #161804)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 3 01:41:37 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Michael Buch (Michael137)
<details>
<summary>Changes</summary>
Currently we don't benefit from the user-friendly names that `LanguageDescription` returns because we would always use `Language::GetNameForLanguageType`. I'm not aware of a situation where `GetDescription` should prefer the non-human readable form of the name with. This patch removes the call to `GetNameForLanguageType`.
---
Full diff: https://github.com/llvm/llvm-project/pull/161804.diff
1 Files Affected:
- (modified) lldb/source/Target/Language.cpp (+1-4)
``````````diff
diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp
index 484d9badde397..7ce85dd93f091 100644
--- a/lldb/source/Target/Language.cpp
+++ b/lldb/source/Target/Language.cpp
@@ -559,11 +559,8 @@ lldb::LanguageType SourceLanguage::AsLanguageType() const {
}
llvm::StringRef SourceLanguage::GetDescription() const {
- LanguageType type = AsLanguageType();
- if (type)
- return Language::GetNameForLanguageType(type);
return llvm::dwarf::LanguageDescription(
- (llvm::dwarf::SourceLanguageName)name);
+ static_cast<llvm::dwarf::SourceLanguageName>(name));
}
bool SourceLanguage::IsC() const { return name == llvm::dwarf::DW_LNAME_C; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/161804
More information about the lldb-commits
mailing list