From Seo Wiki - Search Engine Optimization and Programming Languages
Clang (pronounced /ˈklæŋ/ like the English word clang) is a compiler front end for the C, C++, and Objective-C programming languages. It uses the Low Level Virtual Machine (LLVM) as its back end. It is still under development. Its goal is to offer a replacement to the GNU Compiler Collection (GCC). Development is sponsored by Apple, and it is licensed using a BSD-like open source license.
One of the most visible uses to date has been an OpenGL code compiler for Mac OS X that converts OpenGL calls into more fundamental calls for graphics processing units that do not support certain features. This allowed Apple to support the entire OpenGL API on computers using Intel Graphics Media Accelerator (GMA) chipsets, increasing performance on those machines. For sufficiently capable GPUs, the code is compiled to take full advantage of the underlying hardware, but on GMA machines, LLVM compiles the same OpenGL code into subroutines to ensure it continues to work properly.
LLVM was originally intended to use GCC's front end, but GCC turned out to cause some problems for both the LLVM developers and Apple. GCC is a large and somewhat cumbersome system to develop; as one long-time GCC developer put it, "Trying to make the hippo dance is not really a lot of fun". Apple software makes heavy use of Objective-C (ObjC), but the ObjC front-end in GCC is a low priority for the current GCC developers. GCC does not fit smoothly into Apple's IDE. GCC is GPL licensed, requiring developers who distribute extensions for (or modified versions of) GCC to make their source code available, whereas LLVM has a BSD-like license.
Clang is a new C-targeted compiler intended specifically to work on top of LLVM. The combination of clang and LLVM provides the majority of a toolchain, allowing the replacement of the whole GCC stack.
One of clang's primary goals is to better support incremental compilation to allow the compiler to be more tightly tied to the IDE GUI. GCC is designed to work in a "classic" compile-link-debug cycle, and although it provides useful ways to support incremental and interrupted compiling on-the-fly, integrating them with other tools is not always easy. For instance, GCC uses a step called "fold" that is key to the overall compile process, which has the side effect of translating the code tree into a form that does not look very much like the original source code. If an error is found during or after the fold step, it can be difficult to translate that back into a single location in the original source. Additionally, vendors using the GCC stack within IDEs used separate tools to index the code to provide features like syntax highlighting and autocomplete.
Clang is designed to retain more information during the compilation process than GCC, and preserve the overall form of the original code. The objective of this is to make it easier to map errors back into the original source. The error reports offered by Clang are also aimed to be more detailed and specific, as well machine-readable, so IDEs can index the output of the compiler during compilation. Since the compiler is always running, it can offer source code indexing, syntax checking, and other features normally associated with rapid application development systems[vague]. The parse tree is also more suitable for supporting automated code refactoring, as it remains in a parsable text form at all times. Changes to the compiler can be checked by diffing the IF.
GCC systems don't support threading at the single compilation level and cannot take advantage of the multi-processor hardware for single compilation units. Clang was designed from the start to be threaded and aims for reduced memory footprint and increased speed. As of October 2007, clang compiled the Carbon libraries well over twice as fast as GCC, while using about five times less memory and disk space.
Although development on GCC may be difficult, the reasons for this have been well explored by its developers. This allowed the clang team to avoid these problems and make a more flexible system. Clang is highly modularized, based almost entirely on replaceable link-time libraries as opposed to source code modules that are combined at compile time, and well documented. This makes it much easier for new developers to get up to speed in clang and add to the project. In some cases the libraries are provided in several versions that can be swapped out at runtime; for instance the parser comes with a version that offers performance measurement of the compile process.
Clang, as the name implies, is a compiler only for C and C-like languages. It does not offer compiler front-ends for languages other than C, C++ and Objective C. For other languages, including Java, FORTRAN and Ada, LLVM remains dependent on GCC. Clang can be used or swapped out for GCC as needed, with no other effects on the toolchain as a whole.
The project is under rapid development. As of December 2009, code generation for C and Objective-C is production-quality, but support for C++ and Objective-C++ is still incomplete. Clang C++ is able to parse GCC 4.2 libstdc++ and generate working code for non-trivial programs  and is able to compile itself 
On February 25, 2009, it was announced that clang/LLVM was able to compile a working FreeBSD kernel. On March 16, 2009, it was announced that clang/LLVM was able to compile a working DragonFly BSD kernel. However, work remains yet before the Linux kernel will compile.
On May 9, 2009, FreeBSD Status Report included that FreeBSD was exploring the possibility of replacing gcc with clang as the default system compiler. An experimental branch of FreeBSD which includes Clang and LLVM was announced on the freebsd-hackers mailing list.
On October 23, 2009 Clang 1.0 was released along with LLVM 2.6 for the first time.
- ↑ http://llvm.org/releases/2.1/LICENSE.TXT
- ↑ Christopher, Eric (2008-07-03). "simply wonder pronunciation of Clang". LLVMdev mailing list. http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-July/015624.html. Retrieved 2008-07-09.
- ↑ "Clang Static Analyzer". LLVM. http://clang-analyzer.llvm.org/. Retrieved 2009-09-03.
- ↑ Treat, Adam (19 February 2005). "mkspecs and patches for LLVM compile of Qt4". Qt4-preview-feedback mailing list. http://lists.trolltech.com/qt4-preview-feedback/2005-02/msg00691.html.
- ↑ Lattner, Chris (May 25, 2007). "LLVM for OpenGL and other stuff" (Slides). LLVM Developers' Meeting. http://llvm.org/devmtg/2007-05/10-Lattner-OpenGL.pdf.
- ↑ Zadeck, Kenneth (19 November 2005). "Re: LLVM/GCC Integration Proposal". GCC development mailing list. http://gcc.gnu.org/ml/gcc/2005-11/msg00918.html.
- ↑ 7.0 7.1 Naroff, Steve (May 25, 2007). "New LLVM C Front-end" (Slides). LLVM Developers' Meeting. http://llvm.org/devmtg/2007-05/09-Naroff-CFE.pdf.
- ↑ 8.0 8.1 8.2 Clang team, clang: a C language family frontend for LLVM
- ↑ Lattner, Chris (11 July 2007). "New LLVM C front-end: "clang"". cfe-dev mailing list. http://lists.cs.uiuc.edu/pipermail/cfe-dev/2007-July/000000.html.
- ↑ "Clang - Features and Goals: Fast compiles and Low Memory Use". October 2007. http://clang.llvm.org/features.html.
- ↑ LLVM Blog, Clang can compile LLVM and Clang
- ↑ Roman Divacky, [ANNOUNCE] clang/LLVM can compile booting FreeBSD kernel on i386/amd64
- ↑ http://wiki.freebsd.org/BuildingFreeBSDWithClang
- ↑ Alex Hornung, "llvm/clang once more
- ↑ http://leaf.dragonflybsd.org/~alexh/clang/clang.html
- ↑ Meta Tracker: Compiling the Linux kernel with clang
- ↑ Brad Davis, "FreeBSD Status Reports January - March, 2009"
- ↑ Ed Schouten, "Clang: now available from a SVN server near you!"
|This article's external links may not follow Wikipedia's policies or guidelines. Please improve this article by removing excessive and inappropriate external links or by converting links into references. (May 2009)|
- Official website
- LLVMdev: New LLVM C front-end: "clang", announcement (11 July 2007)
- Presentation: Ted Kremenek - Finding Bugs with the Clang Static Analyzer, Slides
- Presentation: Steve Naroff - Clang Internals, Slides
- 2009 DevMtg Clang presentationja:Clang