Some time ago, GCC >= 5 and Clang >= 4 compilers changed the semantics of their version numbers, so major version number will increase on any non-bugfix release.
Does Apple follow any versioning schema with clang compiler in terms of ABI compatibility or any other scope? I would like to know if apple-clang 9.0
is ABI compatible with 9.1
and so on.
Wikipedia's Xcode page has a map of Apple to LLVM versions. The LLVM column has the open-source LLVM/Clang version. From this you can look up a language feature in cppreference's chart of compiler support for language features.
Xcode's default toolchain bundled with clang 13. But clang bundled with Swift Open Source toolchain is 10 which behaves different to the default toolchain of current version of Xcode (Xcode 13.1) when compiling Swift project with C++ sources.
According to official documentation, Clang 13 supports C++20 Modules thru the use of a -fmodules command-line parameter.
Apple uses a specialized version of GCC 4.0 and 4.2 in Leopard's Xcode 3.1 that supports compiling Objective-C/C/C++ code to both PowerPC and Intel targets on the desktop and uses GCC 4.0 to target ARM development on the iPhone.
Apple bumps their compiler version number with every Xcode release, so the appropriate place to look for ABI changes are the Xcode release notes. The newest ABI change I could find there was is Xcode 6:
The libc++ headers in Xcode 6 include a change to make std::pair have a trivial constructor. This fix is important for performance and compliance with the C++ standard, but it changes the ABI for C++ code using std::pair.
This implies that there were no ABI changes since 2014.
Edit: The mapping between clang and apple-clang seems to be (taken from here and added the last line myself by feature-testing):
5.1 -> 3.4
6.0 -> 3.5
7.0 -> 3.7
7.3 -> 3.8
8.0 -> 3.9
9.0 -> 4.0
9.1 -> 5.0
So I guess apple bumps the minor version of apple-clang whenever they integrate changes from mainline clang in between major Xcode releases.
But for the original question this does not matter: ABI compatibility of the language will not change until they say so, which is possible for the standard library (but rarely happens) and is almost unthinkable for the core language. For GCC, apple even guaranteed to not do the latter, but probably forgot to update the document when they switched to clang:
Because GCC 4.0 conforms to the Itanium C++ ABI, C++ objects are link-compatible with objects built by other OS X compilers that conform to this specification. Apple guarantees that future releases of GCC for OS X will also conform to the Itanium C++ ABI. This means that developers may safely ship dynamic shared libraries whose interfaces involve C++ classes, albeit with some caveats:
- Apple guarantees ABI stability only for core language features. It does not guarantee stability for library classes, including std::string, std::map, and std::ostream among others.
But as the gcc
command links to apple-clang with any recent Xcode installation, this guarantee should hold for the latter as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With