[llvm] [llvm][Dwarf] Add LanguageDescription API that accounts for version (PR #162048)
Michael Buch via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 6 10:27:44 PDT 2025
================
@@ -472,6 +472,117 @@ StringRef llvm::dwarf::LanguageDescription(dwarf::SourceLanguageName lname) {
return "Unknown";
}
+StringRef llvm::dwarf::LanguageDescription(dwarf::SourceLanguageName Name,
+ uint32_t Version) {
+ switch (Name) {
+ // YYYY
+ case DW_LNAME_Ada: {
+ if (Version <= 1983)
+ return "Ada 83";
+ if (Version <= 1995)
+ return "Ada 95";
+ if (Version <= 2005)
+ return "Ada 2005";
+ if (Version <= 2012)
+ return "Ada 2012";
----------------
Michael137 wrote:
Added unittests in latest commit.
Yea those intermediate values haven't really been specified i think. I took inspiration from the logic in:
https://github.com/llvm/llvm-project/blob/c2765b74ed2bb71bebe96c7dd49f69ade714e5a8/llvm/include/llvm/BinaryFormat/Dwarf.h#L228-L273
There we round up the intermediate version number. Reading https://dwarfstd.org/languages-v6.html, it sounds like the version number specifies the completion of a particular language version. Anything after that is the next version. At least that's how I think about this
https://github.com/llvm/llvm-project/pull/162048
More information about the llvm-commits
mailing list