Who would ever think there would come the day when there would be a threat knocking on the door of the GNU Compiler collection also known as GCC, stronghold. Other platforms but not Unix for God’s sake. That is exactly what what Clang has dared to do and it may have just found a rat hole into scene.
Started back in around 2005, Clang, the open source compiler front end that works on top of the Low Level Virtual Machine has been making headway into the C, C++ and Objective-C realms and family of GCC compilers can no longer take things lying down.
Clang which is primarily sponsored and developed by Apple Inc from scratch to support C99, Objective-C and C++ has already made headway and stripped compile times by half compared to the GCC compiler.
The development of Clang may have or rather has come out of necessity. GCC’s reluctance to clean up their code, prioritize support for Objective-C, and the GPL license were factors that contributed to the development of Clang.
Why Clang
Clang is known to use far less memory than GCC and is proven to be more the twice as fast as GCC when compiling. This has been the focus of the Clang development team. To make it fast light and scalable.
Compiler messages have been reworked to make it more humanly useful. Not only does it give proper and expressive error messages but it also takes a snippet of the offending code so you know where the prolem is right away.
Clang is also compatible with GCC and therefore for the most part can compile code which s laden with GCC specific extensions.
Clang is designed as a library-based architecture. This means the components of Clang are modular and can be used and reused in new and different ways including extending and omitting certain modules.
Designed to integrate seamlessly with IDEs is another design goal of the Clang development team. With this feature you can continue to use for example Visual C++ IDE and use Clang as the underlying compiler.
Development of Clang tools is highly sensitive to the fact that there has been a lot of frustration over the lack of proper compilation tools for C and C++. Clang has stepped into the picture to capitalize on those flaws and build soething that is of worth. Included with this is the simple design model that will allow developers to easily pick up Clangs source code and extend it as they see fit.
No longer is there a need to have seperate parsers for C, C++ and Objective-C as this eventually becomes a maintenance nightmare. Clang also tends to support different varients of the C, C++ and Objective-C languages. SO whichever on you choose to use there should be no problem as far as warning and errors are concerned.
Getting And Compiling C, C++ Objective-C With Clang
You can get clang preferably from this Subversion location
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
For building you an use either Make or CMake for example from the LLVM root directory folder
./configure
make
which will build Low Level Virtual Machine (LLVM) and Clang. With CMake you can generate project file for the popular IDEs such as Qt, COdeblocks, Eclipse and more.
For Visual Studio you would have to run
Cmake
for Visual Studio 2005: and
cmake -G “Visual Studio 9 2008″
for Visual Studio 2008
Additionally you would also need GnuWin32 tools and python to compile with Visual Studio.
All in all this has been a brief about Clang and I will definitely be talking more about Clang in future posts as I put more time into using it on my projects. You can visit the Low Level Virtual Machine website here to learn more about Clang




