Get Apple clang version and corresponding upstream LLVM version

Here is the best listing I've found that correlates Apple's clang versions with the LLVM versions:

https://trac.macports.org/wiki/XcodeVersionInfo

Previous versions used to say what LLVM version they corresponded to, but starting with 7.0, Apple decided to no longer do that. They even define the __clang_version__ and related preprocessor macros to indicate the Apple version number, not the LLVM version. So they're useless for this as well.

Unfortunately, it looks like the only way to see if you have a feature is to try it and check if it works. e.g. 7.0.2 still doesn't have OpenMP enabled by default (although it's enable-able), so I guess it's still 3.6, not 3.7 yet.


As hinted by pkolbus, you can look at the /src/CMakeLists.txt to guess the corresponding Clang version. For example, Apple Clang 800.0.38 and 800.0.42.1 both seem to based on Clang 3.9.0 according to

if(NOT DEFINED LLVM_VERSION_MAJOR)
  set(LLVM_VERSION_MAJOR 3)
endif()
if(NOT DEFINED LLVM_VERSION_MINOR)
  set(LLVM_VERSION_MINOR 9)
endif()
if(NOT DEFINED LLVM_VERSION_PATCH)
  set(LLVM_VERSION_PATCH 0)
endif()
if(NOT DEFINED LLVM_VERSION_SUFFIX)
  set(LLVM_VERSION_SUFFIX svn)
endif()

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.