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

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`.

>From 159ee47db1b9f6f609fe8b6b3e866f995d8f2e5c Mon Sep 17 00:00:00 2001
From: Michael Buch <[email protected]>
Date: Fri, 3 Oct 2025 09:37:52 +0100
Subject: [PATCH] [lldb][Language] Simplify SourceLanguage::GetDescription

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`.
---
 lldb/source/Target/Language.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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; }
 

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to