[llvm] [dsymutil] Use DWARFDie::getLanguage instead of manually finding DW_AT_language (PR #208174)

Michael Buch via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 00:56:15 PDT 2026


================
@@ -146,12 +146,9 @@ Error DWARFLinkerImpl::link() {
       DWARFDie UnitDie = OrigCU->getUnitDIE();
 
       if (!Language) {
-        if (std::optional<DWARFFormValue> Val =
-                UnitDie.find(dwarf::DW_AT_language)) {
-          uint16_t LangVal = dwarf::toUnsigned(Val, 0);
-          if (isODRLanguage(LangVal))
-            Language = LangVal;
-        }
+        if (std::optional<uint64_t> LangVal = UnitDie.getLanguage())
+          if (isODRLanguage(*LangVal))
+            Language = static_cast<uint16_t>(*LangVal);
----------------
Michael137 wrote:

Hmm or perhaps turn `Language` into a `uint16_t`? Since that's how the DWARF spec defines it and LLVM represents it as.

Either way, possibly better to do in a separate patch? This patch here was meant to be just mechanical

Wdyt?

https://github.com/llvm/llvm-project/pull/208174


More information about the llvm-commits mailing list