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. 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.
Clang is carefully and thoughtfully designed and built to provide the foundation of a whole new generation of C/C++/Objective C development tools.
Clang supports a broad variety of language extensions. These extensions are provided to be compatible with the GCC, Microsoft, and other popular compilers as well as to improve functionality through clang-specific features. The Clang driver and language features are intentionally designed to be as compatible with the GCC compiler as reasonably possible, easing migration from GCC to Clang.
Key Features
- Fast compiles and low memory use – the library-based architecture of clang makes it straight-forward to time and profile the cost of each layer of the stack.
- Expressive diagnostics, making the diagnostics (error and warning messages) generated by the compiler be as useful as possible.
- GCC compatibility.
- Modular library based architecture:
- libsupport – Basic support library, from LLVM.
- libsystem – System abstraction library, from LLVM.
- libbasic – Diagnostics, SourceLocations, SourceBuffer abstraction, file system caching for input source files.
- libast – Provides classes to represent the C AST, the C type system, builtin functions, and various helpers for analyzing and manipulating the AST (visitors, pretty printers, etc).
- liblex – Lexing and preprocessing, identifier hash table, pragma handling, tokens, and macro expansion.
- libparse – Parsing. This library invokes coarse-grained ‘Actions’ provided by the client (e.g. libsema builds ASTs) but knows nothing about ASTs or other client-specific data structures.
- libsema – Semantic Analysis. This provides a set of parser actions to build a standardized AST for programs.
- libcodegen – Lower the AST to LLVM IR for optimization & code generation.
- librewrite – Editing of text buffers (important for code rewriting transformation, like refactoring).
- libanalysis – Static analysis support.
- libindex – Cross-translation-unit infrastructure and indexing support.
- clang – A driver program, client of the libraries at various levels.
- Support diverse clients (refactoring, static analysis, code generation, etc).
- Allow tight integration with IDEs.
- A real-world, production quality compiler.
- A simple and hackable code base.
- A single unified parser for C, Objective C, C++, and Objective C++.
- Conformance with C/C++/ObjC and their variants.
Website: clang.llvm.org
Support: Manual
Developer: Chris Lattner and contributors
License: University of Illinois / NCSA Open Source License
Clang is written in C++. Learn C++ with our recommended free books and free tutorials.
Related Software
| Compilers | |
|---|---|
| GNU Compiler Collection | The standard compiler for most Unix-like operating systems |
| rustc | Compiler for the Rust programming language |
| AOCC | AMD Optimizing C/C++ Compiler |
| LLVM | Low-Level Virtual Machine (LLVM) compiler for C/C++ |
| ispc | Intel SPMD Program Compiler |
| Babel | JavaScript compiler - use next generation JavaScript |
| Glasgow Haskell Compiler | An optimizing compiler for Haskell, written in Haskell |
| Clang | C Language Family Frontend for LLVM |
| Nuitka | Optimizing Python compiler |
| CHICKEN | Compiler for the Scheme programming language |
| FreeBASIC | 32-bit BASIC compiler |
| Numba | Compiler for Python array and numerical functions |
| Free Pascal | Advanced Pascal compiler for Pascal and Object Pascal |
| NASM | Assembler for the x86 CPU architecture |
| Bigloo | Practical Scheme compiler |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Know a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

