Difference between revisions of "Clang"

From ArchWiki
Jump to: navigation, search
(Added section about the static analyzer.)
(Added text to "Using the Static Analyzer" section and added References section)
Line 8: Line 8:
  
 
== Using the Static Analyzer ==
 
== Using the Static Analyzer ==
 +
First install the {{Pkg|clang-analyzer}} package. To analyze a project, simply place the word {{ic|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 ==
 +
*[http://clang-analyzer.llvm.org/scan-build.html scan-build: running the analyzer from the command line]

Revision as of 13:48, 6 December 2013

Clang is a compiler set based on LLVM. It is distributed under BSD Licence.

Installation

Install clang form 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