Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Apple clang version and corresponding upstream LLVM version

I want to understand which version of clang Apple installed in my macbook, to see with c++11 and/or c++14 features are available. I typed this command:

clang --version  //----response Apple LLVM version 7.0.0 (clang-700.1.76)      Target: x86_64-apple-darwin15.0.0     Thread model: posix 

But I am not able to understand what (clang-700.1.76) mean. How can I convert this code to a clang version?

This is the site where you could check c++ features available in clang version http://clang.llvm.org/cxx_status.html

like image 852
user72708 Avatar asked Nov 09 '15 05:11

user72708


People also ask

How do I know what version of Clang I have Mac?

In the CMakeLists. txt file, look for the line that sets the LLVM_VERSION_MAJOR variable. The MAJOR, MINOR and PATCH versions will give you the exact version of LLVM on which the Apple build is based. For Xcode 13.4, where Apple Clang reports a version of 13.1.

What version of Clang is Xcode using?

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.

Is LLVM and Clang the same?

Clang operates in tandem with the LLVM compiler back end and has been a subproject of LLVM 2.6 and later. As with LLVM, it is free and open-source software under the Apache License 2.0 software license. Its contributors include Apple, Microsoft, Google, ARM, Sony, Intel, and AMD.


2 Answers

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.

like image 162
John McFarlane Avatar answered Sep 28 '22 04:09

John McFarlane


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.

like image 42
Mike Jarvis Avatar answered Sep 28 '22 05:09

Mike Jarvis