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. Can we make the version of clang bundled with Swift Open Source toolchain to be the same version of current version of Xcode?
Apple clang version numbers and open-source clang version numbers cannot be compared (i.e., open source clang 10 isn't necessarily three versions behind Apple clang 13). Apple's version is continually merged from the open-source version but it is ultimately a proprietary release:
But clang bundled with Swift Open Source toolchain is 10 which behaves different to the default toolchain of current version of Xcode
What specifically do you see it doing differently?
The clang that ships with Swift 5.5 is based on OSS clang 10 in the open source toolchain, but it has moved to OSS clang 13 in the main branch (there is a pull pending to correct the version number reported). I have no idea what Xcode does, but I doubt they've switched to the OSS clang 13 only there: more likely it is using a different versioning scheme, as @xwu says.
See my complaint here: Reproducing the toolchain used by Xcode
I find it endlessly frustrating that Xcode ships with a Clang that is substantially different from anything in open source, even from Apple's llvm fork. There are clearly a number of problems with implicitly-generated modules in open-source Clang that are not present in the one that ships with Xcode; it would be lovely if Apple would publish those fixes if only to their own fork. There also seem to be a bevy of smaller changes, some of which are in the main branch in open source but not cherry-picked to the 5.5 release branch.