A new compiler, with static analyzer to boot

The LLVM Compiler Infrastructure Project is getting ready for their 2.6 release later this month, and for the first time, the Clang compiler front-end is considered ready enough that a snapshot of it is provided, together with the LLVM snapshot itself.

This is of great interest for several reasons. Firstly, Obj-C support in GCC has always been rather tenuous: NeXT, and later Apple, rather dislike that compiler suite’s licensing provision, and as a result the Obj-C runtime is rather neglected. New language features (e.g. Obj-C 2.0, with its garbage collection) will likely not see the light of day.

Secondly, between its support for a myriad of language front-ends, and its venerable age, GCC is not as easily extendable as it could have been. Hard to integrate it with a modern IDE, as Apple is noticing.

And lastly, LLVM IR is a *beautiful* assembly language to write to. Arbitrary-precision integer arithmetic? Check. Functions? Check. Support for various calling conventions? Check. Infinite SSA registers? Check.

Actually, that’s not even the last point. Clang also comes with a static analyzer, that lets you hook it into a GCC compilation process — amusingly, it does not seem to work yet when using Clang as the compiler. I’d be happy to stand corrected on this, though. It provides readable warnings in HTML!

And now all this is yours to test! If you are on Rawhide, install as such:

$ yum install llvm   # to install LLVM itself
$ yum install clang  # to install the clang compiler

Or get clang and clang-analyzer together by using

<br />$ yum install clang-analyzer<br />

Fedora 11 users will have to wait until slightly after 2.6 final is out. We are trying to get OpenGTL packaged, and at this point it does not build against LLVM 2.6 due to API changes.Technorati Tags: , , , ,

One response to “A new compiler, with static analyzer to boot