Is there any reason Swift's compile script mess with LLVM's version numbers?

Hi:

I'm currently working with swift-5.4 release and couldn't help notice swift/utils/build_toolchain.py is setting:

-DLLVM_VERSION_MAJOR:STRING=10 -DLLVM_VERSION_MINOR:STRING=0 -DLLVM_VERSION_PATCH:STRING=0 -DCLANG_VERSION_MAJOR:STRING=10

I'm currently working on porting a downstream project that uses those values to maintain cross-LLVM version API compatibility and this completely broke it

when the base LLVM version is 11.1.0, as listed in llvm-project/CMakeLists.txt at swift/release/5.4 · apple/llvm-project · GitHub

Apparently utils/build_swift/build_swift/defaults.py should be updated for each branch but wasn't for some reason

A more serious question would be: Why this behavior exists in the first place?
Initially I thought this was to work with Apple's own versioning scheme, but it seems those options are not used to present the final version string:

➜  ~ swiftc --version
Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55)
Target: x86_64-apple-darwin20.3.0
➜  ~ clang --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
➜  ~ 

Terms of Service

Privacy Policy

Cookie Policy