What is the LLVM version bundled with Xcode?

2019-02-09 05:44发布

问题:

Up to Xcode 6 when typing clang --version we got the information on what LLVM version it was built:

Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)

But now with Xcode 7 we only get the following:

Apple LLVM version 7.0.0 (clang-700.0.72)

回答1:

See https://gist.github.com/yamaya/2924292 in which an interesting comment says:

Looking at the sources (src/CMakeLists.txt), it appears AppleClang is based on (approximately) the following LLVM branches: clang-700.0.72 => LLVM 3.7.0 clang-700.1.76 => LLVM 3.7.0 clang-700.1.81 => LLVM 3.7.0 clang-703.0.29 => LLVM 3.8.0 clang-703.0.31 => LLVM 3.8.0



回答2:

The LLVM version reported was always misleading. "3.6.0svn" means that code was branched some time after 3.5 and before 3.6. However, Apple also applies bunch of local changes and backports bug fixes, so there is no way in general to relate to a particular mainline revision. This is why they removed it. And really, one need to treat Apple-shipped clang as a separate compiler (compared to the mainline clang).



回答3:

The wiki had show us already. https://en.wikipedia.org/wiki/Xcode#Latest_versions

Actually we can check swift version the Xcode used, and see the llvm version in swift-llvm

For Xcode 10, the swift version is 4.2, from CMakeLists.txt we can get the llvm version is 6.0.1 if(NOT DEFINED LLVM_VERSION_MAJOR) set(LLVM_VERSION_MAJOR 6) endif() if(NOT DEFINED LLVM_VERSION_MINOR) set(LLVM_VERSION_MINOR 0) endif() if(NOT DEFINED LLVM_VERSION_PATCH) set(LLVM_VERSION_PATCH 1) endif()

And Apple should not use two versions of llvm in clang and swift :)