Difference between revisions of "Clang"

From ArchWiki
Jump to: navigation, search
(Installation)
(Tidy up usage)
Line 1: Line 1:
 
[[Category:Package development]]
 
[[Category:Package development]]
[http://clang.llvm.org/ Clang] is a compiler set based on LLVM. It is distributed under BSD Licence.
+
[http://clang.llvm.org/ Clang] is a C/C++/Objective C compiler based on LLVM. It is distributed under the BSD Licence.
 
== Installation ==
 
== Installation ==
 
Install {{pkg|clang}} from the [[Official repositories]].
 
Install {{pkg|clang}} from the [[Official repositories]].
  
 
== Build packages with Clang ==
 
== Build packages with Clang ==
Add {{ic|1=export CC=clang}} and (for c++) {{ic|1=export CXX=clang++}} to your {{ic|/etc/makepkg.conf}}.
+
Add {{ic|1=export CC=clang}} and (for C++) {{ic|1=export CXX=clang++}} to your {{ic|/etc/makepkg.conf}}.
  
 
== Using the Static Analyzer ==
 
== Using the Static Analyzer ==

Revision as of 03:13, 2 March 2014

Clang is a C/C++/Objective C compiler based on LLVM. It is distributed under the BSD Licence.

Installation

Install clang from the Official repositories.

Build packages with Clang

Add export CC=clang and (for C++) export CXX=clang++ to your /etc/makepkg.conf.

Using the Static Analyzer

First install the clang-analyzer package. To analyze a project, simply place the word scan-build in front of your build command. For example:

$ scan-build make

It is also possible to analyze specific files:

$ scan-build gcc -c t1.c t2.c

References