Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What's the difference between clang and clang llvm?


Asked by Fallon Fischer on Nov 30, 2021 FAQ



Previously, the NDK used GCC as compiler. With GCC, each target architecture (arm, aarch64, x86 etc) had a separate copy of GCC built with that individual target configured. Clang/LLVM on the other hand can target any configured architecture with one single compiler executable.
In respect to this,
The Clang project provides a language front-end and tooling infrastructure for languages in the C language family (C, C++, Objective C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project. Both a GCC-compatible compiler driver ( clang) and an MSVC-compatible compiler driver ( clang-cl.exe) are provided.
Likewise, Front end ( Clang ) takes the source code and generates abstract syntax tree ( LLVM IR ). Optimizer takes the LLVM IR and generates more optimized code using dead code elimination, constant propagation and other techniques ( Optimizing compiler ).
In this manner,
GCC is licensed under GPL (GNU public license) whereas Clang/LLVM is licensed under Apache License. GCC Vs Clang comparison under the head of the license should be best left to the lawyers. Supported platforms – Both GCC and Clang support almost all the modern platforms.
Also,
Differences are in the following areas. 1) Licensing : GCC has GPL license while LLVM has BSD license. The BSD license allows LLVM to be used and sold in commercial tools (which are not open-source). 2) Source Programming Language : GCC is mostly coded in C while LLVM is mostly in C++.