clang: a C language family frontend for LLVM
The goal of the Clang project is to create a new C, C++, Objective C and Objective C++ front-end for the LLVM compiler.
Features/Goals
Some of the goals for the project include the following:
- Real-world, production quality compiler.
- A single unified parser for C, Objective C, C++, and Objective C++.
- Language conformance with these languages and their variants, like C90, C99, etc.
- GCC compatibility: support GCC extensions, but allow them to be disabled.
- High performance and low memory use.
- Build a library-based architecture with finely crafted APIs, allowing the code to be reused in many ways.
- Support many clients such as refactoring, static analysis, as well as code generation.
- Design for integration with IDEs as well as code generation with the LLVM Optimizer and Code Generator.
- Expressive diagnostics: warnings and errors that are actually helpful and make sense.
- Use the LLVM 'BSD' License.
Of course this is only a rough outline of the goals and features of Clang. To get a true sense of what the new LLVM front-end is all about, as well as why you might want to considering using it, see the Features section.
Why?
The development of a new front-end was started out of a need -- a need for a compiler that allows better diagnostics, better integration with IDEs, a license that is compatible with commercial products, and a compiler that is easier to develop and maintain. All of these were motivations for starting work on a new front-end that could meet these needs.
A good (but quite dated) introduction to Clang can be found in the following video lectures:
- Clang Introduction (May 2007)
- Features and Performance of Clang (July 2007)
For a more detailed comparison between Clang and other compilers, please see the clang comparison page.
Current Status
Clang is still in early development stages. If you are looking for source analysis or source-to-source transformation tools, clang is probably a great solution for you. If you want to use it as a drop in C compiler, it is not yet ready.
Clang currently has pretty good parsing and semantic analysis support for C and Objective-C right now, and bugs are usually quickly fixed once reported. C++ support is still very early, and we don't expect to have respectable C++ support for another 2 years or so.
Get Involved
The developers of Clang include contributers from Apple and numerous other volunteers. If you are interested in joining the community or learning more, please consider joining the cfe-dev mailing list, or start by browsing its archives.
If you are interested in trying out Clang, please see the build instructions on the Get Involved page.