Clang!

Has anyone tried it, yet?
For those interested:

http://blog.llvm.org/2010/02/clang-successfully-self-hosts.html

I'm going to try it out very soon. I was waiting for C++ support to be complete.
Looking into it right now ...

So it is an IDE?
Last edited on
It is a compiler tool set.
closed account (z05DSL3A)
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/Xcode-3.2.1/man1/clang.1.html
Got it, thank Grey Wolf + smith.
Available Packages
Name       : clang
Arch       : x86_64
Version    : 2.6
Release    : 0.5.pre1.fc12
Size       : 4.7 M
Repo       : fedora
Summary    : A C language family frontend for LLVM
URL        : http://llvm.org/
License    : NCSA
Description: clang: noun
           :     1. A loud, resonant, metallic sound.
           :     2. The strident call of a crane or goose.
           :     3. C-language family front-end toolkit.
           : 
           : The goal of the Clang project is to create a new C, C++, Objective
           : C and Objective C++ front-end for the LLVM compiler. Its tools are
           : built as libraries and designed to be loosely-coupled and
           : extendable.


Probably should install this now. I have no idea what the 2.6 version is capable or incapable of yet.
From the man page:

BUGS
       Clang currently does not have C++ support, and this manual page is
       incomplete.  To report bugs, please visit <http://llvm.org/bugs/>.
       Most bug reports should include preprocessed source files (use the -E
       option) and the full output of the compiler, along with information to
       reproduce.


Oh well -- I guess I'll have to wait a while to do anything interesting with it.
Actually, it does have some C++ support. After all, it's written in C++ and it's self-hosted. It's still incomplete, unfortunately.
http://clang.llvm.org/cxx_status.html
I think it's kinda odd that they'd write the front-end in C++ and then implement C first, but I guess they had their priorities.

EDIT: And I almost can't believe it. The source formatting is readable!
Last edited on
The version shipped with Fedora 12 (version 2.6) will not compile a "Hello, world!" C program with the C++ compiler:

$ clang hello_clang.C -o hello_clang
In file included from hello_clang.C:1:
/usr/include/stdio.h:432:12: error: exception specification in declaration does
      not match previous declaration
extern int __REDIRECT (sscanf, (__const char *__restrict __s,
           ^
/usr/include/stdio.h:432:24: note: instantiated from:
extern int __REDIRECT (sscanf, (__const char *__restrict __s,
                       ^
/usr/include/stdio.h:417:12: note: previous declaration is here
extern int sscanf (__const char *__restrict __s,
           ^
/usr/include/stdio.h:434:27: error: expected ';' at end of declaration
                       __isoc99_sscanf) __THROW;
                                        ^
/usr/include/sys/cdefs.h:51:20: note: instantiated from:
#   define __THROW      throw ()
                        ^
/usr/include/stdio.h:434:27: error: expected unqualified-id
/usr/include/stdio.h:486:12: error: exception specification in declaration does
      not match previous declaration
extern int __REDIRECT (vsscanf,
           ^
/usr/include/stdio.h:486:24: note: instantiated from:
extern int __REDIRECT (vsscanf,
                       ^
/usr/include/stdio.h:467:12: note: previous declaration is here
extern int vsscanf (__const char *__restrict __s,
           ^
/usr/include/stdio.h:490:6: error: expected ';' at end of declaration
     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
     ^
/usr/include/sys/cdefs.h:51:20: note: instantiated from:
#   define __THROW      throw ()
                        ^
/usr/include/stdio.h:490:6: error: expected unqualified-id
8 diagnostics generated.


Taking the same file as a .c (C source) and compiling it produces an executable.
That's weird, because I just built from the SVN trunk and it says it's 1.1.
Very odd:

clang -v 
clang version 1.0 (https://llvm.org/svn/llvm-project/cfe/branches/release_26 )
Target: x86_64-unknown-linux-gnu
Thread model: posix


And this:
rpm -q clang
clang-2.6-0.5.pre1.fc12.x86_64

Topic archived. No new replies allowed.