<s>
Clang	B-Application
(	O
/klæŋ/	O
)	O
is	O
a	O
compiler	O
front	O
end	O
for	O
the	O
C	B-Language
,	O
C++	B-Language
,	O
Objective-C	B-Language
,	O
and	O
Objective-C	B-Language
++	O
programming	O
languages	O
,	O
as	O
well	O
as	O
the	O
OpenMP	B-Application
,	O
OpenCL	B-Application
,	O
RenderScript	B-Application
,	O
CUDA	B-Architecture
,	O
SYCL	B-Language
,	O
and	O
HIP	O
frameworks	O
.	O
</s>
<s>
It	O
acts	O
as	O
a	O
drop-in	B-Architecture
replacement	I-Architecture
for	O
the	O
GNU	B-Application
Compiler	I-Application
Collection	I-Application
(	O
GCC	B-Application
)	O
,	O
supporting	O
most	O
of	O
its	O
compilation	O
flags	O
and	O
unofficial	O
language	O
extensions	O
.	O
</s>
<s>
Clang	B-Application
operates	O
in	O
tandem	O
with	O
the	O
LLVM	B-Application
compiler	O
back	O
end	O
and	O
has	O
been	O
a	O
subproject	O
of	O
LLVM	B-Application
2.6	O
and	O
later	O
.	O
</s>
<s>
As	O
with	O
LLVM	B-Application
,	O
it	O
is	O
free	B-License
and	I-License
open-source	I-License
software	I-License
under	O
the	O
Apache	B-Application
License	I-Application
2.0	I-Application
software	O
license	O
.	O
</s>
<s>
Its	O
contributors	O
include	O
Apple	O
,	O
Microsoft	O
,	O
Google	B-Application
,	O
ARM	O
,	O
Sony	O
,	O
Intel	O
,	O
and	O
AMD	O
.	O
</s>
<s>
Clang	B-Application
15	O
,	O
the	O
latest	O
major	O
version	O
of	O
Clang	B-Application
as	O
of	O
March	O
2023	O
,	O
has	O
full	O
support	O
for	O
all	O
published	O
C++	B-Language
standards	O
up	O
to	O
C++17	B-Language
,	O
implements	O
most	O
features	O
of	O
C++20	B-Language
,	O
and	O
has	O
initial	O
support	O
for	O
the	O
upcoming	O
C++23	B-Language
standard	O
.	O
</s>
<s>
Since	O
v6.0.0	O
,	O
Clang	B-Application
compiles	O
C++	B-Language
using	O
the	O
GNU++14	O
dialect	O
by	O
default	O
,	O
which	O
includes	O
features	O
from	O
the	O
C++14	B-Language
standard	O
and	O
conforming	O
GNU	O
extensions	O
.	O
</s>
<s>
Starting	O
in	O
2005	O
,	O
Apple	O
Inc	O
.	O
began	O
extensive	O
use	O
of	O
LLVM	B-Application
in	O
several	O
commercial	O
products	O
,	O
including	O
the	O
iOS	B-Operating_System
SDK	I-Operating_System
and	O
Xcode	B-Operating_System
3.1	O
.	O
</s>
<s>
One	O
of	O
the	O
first	O
uses	O
of	O
LLVM	B-Application
was	O
an	O
OpenGL	B-Application
code	O
compiler	O
for	O
OS	B-Operating_System
X	I-Operating_System
that	O
converts	O
OpenGL	B-Application
calls	O
into	O
more	O
fundamental	O
calls	O
for	O
graphics	B-Architecture
processing	I-Architecture
units	I-Architecture
(	O
GPU	B-Architecture
)	O
that	O
do	O
not	O
support	O
certain	O
features	O
.	O
</s>
<s>
This	O
allowed	O
Apple	O
to	O
support	O
OpenGL	B-Application
on	O
computers	O
using	O
Intel	B-Device
GMA	I-Device
chipsets	O
,	O
increasing	O
performance	O
on	O
those	O
machines	O
.	O
</s>
<s>
The	O
LLVM	B-Application
project	O
originally	O
intended	O
to	O
use	O
GCC	B-Application
's	O
front	O
end	O
.	O
</s>
<s>
The	O
GCC	B-Application
source	O
code	O
,	O
however	O
,	O
is	O
large	O
and	O
somewhat	O
cumbersome	O
;	O
as	O
one	O
long-time	O
GCC	B-Application
developer	O
put	O
it	O
referring	O
to	O
LLVM	B-Application
,	O
"	O
Trying	O
to	O
make	O
the	O
hippo	O
dance	O
is	O
not	O
really	O
a	O
lot	O
of	O
fun	O
"	O
.	O
</s>
<s>
Besides	O
,	O
Apple	O
software	O
uses	O
Objective-C	B-Language
,	O
which	O
is	O
a	O
low	O
priority	O
for	O
GCC	B-Application
developers	O
.	O
</s>
<s>
As	O
such	O
,	O
GCC	B-Application
does	O
not	O
integrate	O
smoothly	O
into	O
Apple	O
's	O
integrated	B-Application
development	I-Application
environment	I-Application
(	O
IDE	O
)	O
.	O
</s>
<s>
Finally	O
,	O
GCC	B-Application
's	O
license	O
agreement	O
,	O
the	O
GNU	O
General	O
Public	O
License	O
(	O
GPL	O
)	O
version	O
3	O
,	O
requires	O
developers	O
who	O
distribute	O
extensions	O
or	O
modified	O
versions	O
of	O
GCC	B-Application
to	O
make	O
their	O
source	O
code	O
available	O
,	O
but	O
LLVM	B-Application
's	O
permissive	B-License
software	I-License
license	I-License
does	O
n't	O
require	O
this	O
.	O
</s>
<s>
In	O
the	O
end	O
,	O
Apple	O
chose	O
to	O
develop	O
Clang	B-Application
,	O
a	O
new	O
compiler	O
front	O
end	O
that	O
supports	O
C	B-Language
,	O
Objective-C	B-Language
and	O
C++	B-Language
.	O
</s>
<s>
Clang	B-Application
works	O
in	O
tandem	O
with	O
LLVM	B-Application
.	O
</s>
<s>
The	O
combination	O
of	O
Clang	B-Application
and	O
LLVM	B-Application
provides	O
most	O
of	O
the	O
toolchain	B-General_Concept
for	O
replacing	O
the	O
GCC	B-Application
stack	B-Application
.	O
</s>
<s>
One	O
of	O
Clang	B-Application
's	O
main	O
goals	O
is	O
to	O
provide	O
a	O
library-based	O
architecture	O
,	O
so	O
that	O
the	O
compiler	O
could	O
interoperate	O
with	O
other	O
tools	O
that	O
interact	O
with	O
source	O
code	O
,	O
such	O
as	O
integrated	B-Application
development	I-Application
environments	I-Application
(	O
IDE	O
)	O
.	O
</s>
<s>
In	O
contrast	O
,	O
GCC	B-Application
works	O
in	O
a	O
compile-link-debug	O
workflow	O
;	O
integrating	O
it	O
with	O
other	O
tools	O
is	O
not	O
always	O
easy	O
.	O
</s>
<s>
For	O
instance	O
,	O
GCC	B-Application
uses	O
a	O
step	O
called	O
fold	O
that	O
is	O
key	O
to	O
the	O
overall	O
compile	O
process	O
,	O
which	O
has	O
the	O
side	O
effect	O
of	O
translating	O
the	O
code	O
tree	O
into	O
a	O
form	O
that	O
looks	O
unlike	O
the	O
original	O
source	O
code	O
.	O
</s>
<s>
Besides	O
,	O
vendors	O
using	O
the	O
GCC	B-Application
stack	B-Application
within	O
IDEs	O
must	O
use	O
separate	O
tools	O
to	O
index	O
the	O
code	O
,	O
to	O
provide	O
features	O
like	O
syntax	O
highlighting	O
and	O
intelligent	B-Application
code	I-Application
completion	I-Application
.	O
</s>
<s>
Clang	B-Application
retains	O
more	O
information	O
during	O
the	O
compiling	O
process	O
than	O
GCC	B-Application
,	O
and	O
preserves	O
the	O
overall	O
form	O
of	O
the	O
original	O
code	O
,	O
making	O
it	O
easier	O
to	O
map	O
errors	O
back	O
into	O
the	O
original	O
source	O
.	O
</s>
<s>
Clang	B-Application
's	O
error	O
reports	O
are	O
more	O
detailed	O
,	O
specific	O
,	O
and	O
machine-readable	O
,	O
so	O
IDEs	O
can	O
index	O
the	O
compiler	O
's	O
output	O
.	O
</s>
<s>
Clang	B-Application
compiles	O
only	O
C-like	O
languages	O
,	O
such	O
as	O
C	B-Language
,	O
C++	B-Language
,	O
Objective-C	B-Language
,	O
and	O
Objective-C	B-Language
++	O
.	O
</s>
<s>
In	O
many	O
cases	O
,	O
Clang	B-Application
can	O
replace	O
GCC	B-Application
as	O
needed	O
,	O
with	O
no	O
other	O
effects	O
on	O
the	O
toolchain	B-General_Concept
as	O
a	O
whole	O
.	O
</s>
<s>
It	O
supports	O
most	O
of	O
the	O
commonly	O
used	O
GCC	B-Application
options	O
.	O
</s>
<s>
A	O
Fortran	B-Application
project	O
,	O
Flang	O
was	O
in-progress	O
in	O
2022	O
.	O
</s>
<s>
However	O
,	O
for	O
other	O
languages	O
,	O
such	O
as	O
Ada	B-Language
,	O
LLVM	B-Application
remains	O
dependent	O
on	O
GCC	B-Application
or	O
another	O
compiler	O
front	O
end	O
.	O
</s>
<s>
The	O
Flang	O
project	O
by	O
Nvidia	O
and	O
The	B-Application
Portland	I-Application
Group	I-Application
adds	O
Fortran	B-Application
support	O
.	O
</s>
<s>
Development	O
versions	O
of	O
Flang	O
were	O
in	O
progress	O
and	O
could	O
be	O
downloaded	O
from	O
the	O
LLVM	B-Application
Project	O
;	O
version	O
15.0	O
had	O
been	O
announced	O
.	O
</s>
<s>
Clang	B-Application
is	O
compatible	O
with	O
GCC	B-Application
.	O
</s>
<s>
Its	O
command-line	B-Application
interface	I-Application
shares	O
many	O
of	O
GCC	B-Application
's	O
flags	O
and	O
options	O
.	O
</s>
<s>
Clang	B-Application
implements	O
many	O
GNU	O
language	O
extensions	O
and	O
compiler	B-Application
intrinsics	I-Application
,	O
some	O
of	O
which	O
are	O
purely	O
for	O
compatibility	O
.	O
</s>
<s>
For	O
example	O
,	O
even	O
though	O
Clang	B-Application
implements	O
atomic	O
intrinsics	O
which	O
correspond	O
exactly	O
with	O
C11	O
atomics	B-General_Concept
,	O
it	O
also	O
implements	O
GCC	B-Application
's	O
__sync_*	O
intrinsics	O
for	O
compatibility	O
with	O
GCC	B-Application
and	O
libstdc++	B-Language
.	O
</s>
<s>
Clang	B-Application
also	O
maintains	O
ABI	B-Operating_System
compatibility	O
with	O
GCC-generated	O
object	B-Language
code	I-Language
.	O
</s>
<s>
In	O
practice	O
,	O
Clang	B-Application
is	O
a	O
drop-in	B-Architecture
replacement	I-Architecture
for	O
GCC	B-Application
.	O
</s>
<s>
Clang	B-Application
's	O
developers	O
aim	O
to	O
reduce	O
memory	O
footprint	O
and	O
increase	O
compilation	O
speed	O
compared	O
to	O
competing	O
compilers	O
,	O
such	O
as	O
GCC	B-Application
.	O
</s>
<s>
In	O
October	O
2007	O
,	O
they	O
report	O
that	O
Clang	B-Application
compiled	O
the	O
Carbon	B-Operating_System
libraries	O
more	O
than	O
twice	O
as	O
fast	O
as	O
GCC	B-Application
,	O
while	O
using	O
about	O
one-sixth	O
GCC	B-Application
's	O
memory	O
and	O
disk	O
space	O
.	O
</s>
<s>
By	O
2011	O
,	O
Clang	B-Application
seems	O
to	O
retain	O
this	O
advantage	O
in	O
compiler	O
performance	O
.	O
</s>
<s>
As	O
of	O
mid-2014	O
,	O
Clang	B-Application
still	O
consistently	O
compiles	O
faster	O
than	O
GCC	B-Application
in	O
a	O
mixed	O
compile	O
time	O
and	O
program	O
performance	O
benchmark	O
.	O
</s>
<s>
However	O
,	O
by	O
2019	O
,	O
Clang	B-Application
is	O
significantly	O
slower	O
at	O
compiling	O
the	O
Linux	B-Operating_System
Kernel	I-Operating_System
than	O
GCC	B-Application
while	O
remaining	O
slightly	O
faster	O
at	O
compiling	O
LLVM	B-Application
.	O
</s>
<s>
While	O
Clang	B-Application
has	O
historically	O
been	O
faster	O
than	O
GCC	B-Application
at	O
compiling	O
,	O
the	O
output	O
quality	O
has	O
lagged	O
behind	O
.	O
</s>
<s>
As	O
of	O
2014	O
,	O
performance	O
of	O
Clang-compiled	O
programs	O
lagged	O
behind	O
performance	O
of	O
the	O
GCC-compiled	O
program	O
,	O
sometimes	O
by	O
large	O
factors	O
(	O
up	O
to	O
5.5x	O
)	O
,	O
replicating	O
earlier	O
reports	O
of	O
slower	O
performance	O
.	O
</s>
<s>
Comparisons	O
in	O
November	O
2016	O
between	O
GCC	B-Application
4.8.2	O
versus	O
clang	B-Application
3.4	O
,	O
on	O
a	O
large	O
harness	O
of	O
test	O
files	O
shows	O
that	O
GCC	B-Application
outperforms	O
clang	B-Application
by	O
approximately	O
17%	O
on	O
well-optimized	O
source	O
code	O
.	O
</s>
<s>
Test	O
results	O
are	O
code-specific	O
,	O
and	O
unoptimized	O
C	B-Language
source	O
code	O
can	O
reverse	O
such	O
differences	O
.	O
</s>
<s>
Comparisons	O
in	O
2019	O
on	O
Intel	B-Device
Ice	I-Device
Lake	I-Device
has	O
shown	O
that	O
programs	O
generated	O
by	O
Clang	B-Application
10	O
has	O
achieved	O
96%	O
of	O
the	O
performance	O
of	O
GCC	B-Application
10	O
over	O
41	O
different	O
benchmarks	O
(	O
while	O
winning	O
22	O
and	O
losing	O
19	O
out	O
of	O
them	O
)	O
.	O
</s>
<s>
libclang	O
provides	O
a	O
C	B-Language
interface	O
,	O
providing	O
a	O
relatively	O
small	O
API	O
.	O
</s>
<s>
Exposed	O
functionality	O
includes	O
:	O
parsing	O
source	O
code	O
into	O
an	O
AST	B-Data_Structure
,	O
loading	O
ASTs	O
,	O
traversing	O
the	O
AST	B-Data_Structure
,	O
associating	O
source	O
locations	O
with	O
elements	O
within	O
the	O
AST	B-Data_Structure
.	O
</s>
<s>
This	O
table	O
presents	O
only	O
significant	O
steps	O
and	O
releases	O
in	O
Clang	B-Application
history	O
.	O
</s>
<s>
Date	O
Highlights11	O
July	O
2007Clang	O
frontend	O
released	O
under	O
open-source	O
licence25	O
February	O
2009Clang/LLVM	O
can	O
compile	O
a	O
working	O
FreeBSD	B-Operating_System
kernel.16	O
March	O
2009Clang/LLVM	O
can	O
compile	O
a	O
working	O
DragonFly	B-Application
BSD	I-Application
kernel.23	O
October	O
2009Clang	O
1.0	O
released	O
,	O
with	O
LLVM	B-Application
2.6	O
for	O
the	O
first	O
time.December	O
2009Code	O
generation	O
for	O
C	B-Language
and	O
Objective-C	B-Language
reach	O
production	O
quality	O
.	O
</s>
<s>
Support	O
for	O
C++	B-Language
and	O
Objective-C	B-Language
++	O
still	O
incomplete	O
.	O
</s>
<s>
Clang	B-Application
C++	I-Application
can	O
parse	O
GCC	B-Application
4.2	O
libstdc++	B-Language
and	O
generate	O
working	O
code	O
for	O
non-trivial	O
programs	O
,	O
and	O
can	O
compile	O
itself.2	O
February	O
2010Clang	O
self-hosting.20	O
May	O
2010Clang	O
latest	O
version	O
built	O
the	O
Boost	B-Language
C++	I-Language
libraries	I-Language
successfully	O
,	O
and	O
passed	O
nearly	O
all	O
tests.10	O
June	O
2010Clang/LLVM	O
becomes	O
integral	O
part	O
of	O
FreeBSD	B-Operating_System
,	O
but	O
default	O
compiler	O
is	O
still	O
GCC.25	O
October	O
2010Clang/LLVM	O
can	O
compile	O
a	O
working	O
modified	O
Linux	O
kernel.January	O
2011Preliminary	O
work	O
completed	O
to	O
support	O
the	O
draft	O
C++0x	B-Language
standard	O
,	O
with	O
a	O
few	O
of	O
the	O
draft	O
's	O
new	O
features	O
supported	O
in	O
Clang	B-Application
development	O
version.10	O
February	O
2011Clang	O
can	O
compile	O
a	O
working	O
HotSpot	B-Language
Java	O
virtual	O
machine.19	O
January	O
2012Clang	O
becomes	O
an	O
optional	O
component	O
in	O
NetBSD	B-Device
cross-platform	O
build	O
system	O
,	O
but	O
GCC	B-Application
is	O
still	O
default.29	O
February	O
2012Clang	O
3.0	O
can	O
rebuild	O
91.2	O
%	O
of	O
the	O
Debian	O
archive.29	O
February	O
2012Clang	O
becomes	O
default	O
compiler	O
in	O
MINIX	O
312	O
May	O
2012Clang/LLVM	O
announced	O
to	O
replace	O
GCC	B-Application
in	O
FreeBSD.5	O
November	O
2012Clang	O
becomes	O
default	O
compiler	O
in	O
FreeBSD	B-Operating_System
10.x	O
on	O
amd64/i386.18	O
February	O
2013Clang/LLVM	O
can	O
compile	O
a	O
working	O
modified	O
Android	B-Application
Linux	I-Application
Kernel	I-Operating_System
for	O
Nexus	O
7.19	O
April	O
2013Clang	O
is	O
C++11	B-Language
feature	O
complete.6	O
November	O
2013Clang	O
is	O
C++14	B-Language
feature	O
complete.11	O
September	O
2014Clang	O
3.5	O
can	O
rebuild	O
94.3	O
%	O
of	O
the	O
Debian	O
archive	O
.	O
</s>
