Clang


Table of Contents

Description

The Clang C/C++ compiler.

Macros

TypeMacroFormatDescription
Identification__clang__  
Version__clang_major__VV = Major version
Version__clang_minor__RR = Minor version
Version__clang_patchlevel__V.R.PP = Patch level
Version__clang_version__V.R.P (tags/RELEASE_VRP/final)V = Major R = Minor P = Patch

Notes:

Notice that clang also defines the GNU C version macros, but you should use the clang feature checking macros to detect the availability of various features.

The values of the __clang_major__, __clang_minor__, and __clang_patchlevel__ macros are not consistent across distributions of the Clang compiler. For example, the Clang 3.1 distribution available at http://clang.llvm.org defines __clang_major__ and __clang_minor__ as 3 and 1 respectively. The version of Clang distributed with Apple XCode 4.4 is branded as "Apple Clang 4.0" and derives from the open source Clang 3.1 distribution, but defines these macros with the values 4 and 0 respectively. Apple's Clang distribution can be identified by the presence of the __apple_build_version__ macro.

The meaning of the __clang__ and related macros has changed subtly over the years, from identifying the Clang compiler to identifying compilers that use the Clang infrastructure. For example, IBM XL C/C++ also defines these macros. IBM XL C/C++ for Linux defines them starting from version 13.1.1. IBM XL C/C++ for AIX defines them starting from version 16.1.

Clang also has an expectation that it is being ised in conjunction with LLVM, so the compiler will define __llvm__ as well.

 
Return to top
 
Created: