[Dwarf-discuss] Proposal: Define a language version scheme for Swift
Adrian Prantl
aprantl@apple.com
Tue Apr 23 00:00:13 GMT 2024
# Swift Language version scheme
## Background
The list of languages at https://dwarfstd.org/languages-v6.html does not list a version scheme for the Swift language. This proposal adds one.
## Overview
The Swift programming language does not have a version scheme defined for DW_AT_language_version. This proposal defines it to use the `VVMM` version scheme. This way "Swift 5.10" would be
```
DW_AT_language(DW_LANG_Swift)
DW_AT_language_version(510)
```
and "Swift 6" would be `DW_AT_language_version(600)`. Even though Swift package releases usually have a Major.Minor.Patch version scheme (e.g., Swift 5.9.2), the Swift compiler frontend's LangOptions data structure only uses Major.Minor to distinguish syntax changes in the parser (see References). This version scheme is designed to match what the compiler does.
## Proposed Changes
Augment the table of language encodings to say
```
Swift DW_LNAME_Swift 0x001a 0 VVMM
```
## Dependencies
Issue 210419.1
## References
https://www.swift.org/download/ (see older releases for a history of versions).
https://github.com/apple/swift/blob/3d32f5fc8a9087add424a2704ef1dcd89c9307ff/include/swift/Basic/LangOptions.h#L174
More information about the Dwarf-discuss
mailing list