[llvm] [llvm][dwarfdump] Pretty-print DW_AT_language_version (PR #164222)
    David Blaikie via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Oct 20 10:49:55 PDT 2025
    
    
  
================
@@ -146,15 +168,28 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
   } else if (std::optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
     Name = AttributeValueString(Attr, *Val);
 
-  if (!Name.empty())
-    WithColor(OS, Color) << Name;
-  else if (Attr == DW_AT_decl_line || Attr == DW_AT_decl_column ||
-           Attr == DW_AT_call_line || Attr == DW_AT_call_column ||
-           Attr == DW_AT_language_version) {
+  auto DumpUnsignedConstant = [&OS,
+                               &DumpOpts](const DWARFFormValue &FormValue) {
     if (std::optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
       OS << *Val;
     else
       FormValue.dump(OS, DumpOpts);
+  };
+
+  llvm::StringRef PrettyVersionName =
+      prettyLanguageVersionString(AttrValue, Die);
+  const bool ShouldDumpRawLanguageVersion =
----------------
dwblaikie wrote:
We don't usually use `const` on locals - ends up feeling pretty inconsistent & then confusing when it is used (eg: why is it on this local, but not on `PrettyVersionName`, or `DumpUnsignedConstant` above?
https://github.com/llvm/llvm-project/pull/164222
    
    
More information about the llvm-commits
mailing list