How can I find the actual Clang version on Mac?

时间秒杀一切 提交于 2020-01-23 04:54:25

问题


Note: None of the answers provided at Get Apple clang version and corresponding upstream LLVM version seems to work anymore.

The download page at http://releases.llvm.org/download.html and the Wikipedia article at https://en.wikipedia.org/wiki/Clang seems to indicate that the most recent Clang version is 6.0.0.

But on my macOS High Sierra version 10.13.3, I see this output:

$ clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ which clang
/usr/bin/clang

This does not seem right. Why is the Apple's version of Clang greater than the current version of Clang?

How do I find out which version of Clang hosted on http://releases.llvm.org/download.html does my Mac's version of Clang correspond to?

I ask this because I see http://releases.llvm.org/6.0.0/tools/clang/docs/UsersManual.html documenting a -pedantic option for the clang command line, but it is not documented in the man page of clang on my system.

$ man clang | grep pedantic
$ clang --help | grep pedantic
$

回答1:


You could try using

echo | clang -dM -E - | grep __clang

and maybe that will give you more reliable numbers. Although I'm speculating since I'm not on a Mac.

Also, clang has had the -pedantic option for a long long time - many versions before 6.0. -pedantic is a GCC option and clang takes after GCC in its options.




回答2:


launch terminal and enter:

clang --version

Apple clang version 11.0.0 (clang-1100.0.33.16)



来源:https://stackoverflow.com/questions/50388290/how-can-i-find-the-actual-clang-version-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!