File size

File size

File size

File size

File size

533.5 MB

Were we to craft a Lenox Globe of programming languages, C++ might be followed by a famous cautionary phrase: Here Be Dragons. The language can be complex and daunting to programmers who are often shouldered with the task of writing large, complex programs. Those millions of code monkeys need help to resist Murphy's siren song and navigate C++'s treacherous waters of memory corruption and concurrency bugs.

Clang is a C++ compiler platform that tries to address these challenges (among others) across the spectrum of development activities. It provides fantastic diagnostics, static and dynamic program analysis, advanced rewriting and refactoring functionality, and language extensibility. Together with improvements to the language in C++11 these help programmers cope with today's code and write better code tomorrow. Clang also makes it easier than ever before to evolve and evaluate new language features and extensions to make C++ itself better.

Through this talk I'll give some background on the Clang compiler, what it does today to make writing C++ better, and how we're using it to help shape the C++ language going forward.

+1. Chandler's very well-presented and very impressive presentation was the [unexpected] highlight of the conference for me (along with Bjarne's sessions). I hope the VC compiler team was taking very careful notes. And I agree that Chandler added a lot to the question panel. I'm looking forward to following the progress of Clang.

I've been wanting to switch over from gcc to clang for about a year or two now. This talk just makes me want it even more but alas it doesn't have good windows support yet

They do not even provide windows binaries you have to figure out how to compile the thing yourself and that's not even a good option. Not a simple as loading the solution file and press 'build solution' button.

"They do not even provide windows binaries you have to figure out how to compile the thing yourself"

You find the binaries here: "http://llvm.org/releases/download.html#2.9"3.0 is missing currently though.

"and that's not even a good option. Not a simple as loading the solution file and press 'build solution' button."

Is that so ;)? Just download CMake, select the source root of LLVM checkout and click "configure" in its gui. Then just click "generate", open the VS10 solution in your build directory and click build solution. If that's too hard, then I don't have any other suggestions...

@thesaint: It's been a while since i last checked that page From what i remember. i read something about that they will not provide windows binaries in the future due to the devs not having enough experience with windows or something like that. Perhaps i remember wrong.

I'm not that familiar with linux type compilations. My experience have been that it is messy and complicated and will pollute the windows environmental paths beyond recognition. In other words its better not to even try it because it may not even work and will possible break windows.

First of all, I want to express my appreciation to the CLang group for making making another C++ compiler. This is a huge job.

Chandler's talk focused on the unique features of CLang in regards to error messages and warnings displayed during compilation. It's a fact that C++ (in part to it's legacy compatibility) makes it too easy to write ambiguous code or code which does something different than it looks like it does. So this is a useful facility.

However, I still have a few issues here.

a) it seems to me that a lot of effort is directed to detecting errors in code written in a style which we would prefer to see going away. That is, it seems that a lot of effort is directed to solving last years problems. Making it easier to write/debug badly written code encourages bad practice. Programmers will use this tool to scan their code and find "bugs" and fix their code to make it work. The real solution would be to scan the code and highlight the code which should be "re-styled". I know this is somewhat ambiguously described, so maybe it's not reasonable to expect the builders of CLang to do this. But I think that's what C++ really needs. I know this is a tall order - but hey - that's why these guys earn the big bucks!

b) I'm very concerned that he suggested that a lack of resources (people on the project) with experience with windows held back windows versions of this product. This suggests a coupling of between CLang and the OS. A red flag in my opinion. Certainly the signature facilites of CLang - help for error characterization and syntax checking should be independent of the OS. The only thing that should be coupled to the OS is the implementation of the standard library i/o and memory management facilities.

Admittedly, the only thing I know about CLang is what I learned from Chandler's talk and from looking at one of the test matrices for a boost library so I totally fine with being proved wrong here.

There is *much* more than simply parsing C++ to get Windows "compliance".

There are 2 "big" road-blocks:- MSVC uses non-compliant C++, so to work on Windows and with existing Windows libraries CLang must be modified to allow those quirks and extensions- The ABI need be emulated faithfully, from data layout to name mangling, from virtual dispatch mechanism to exception propagation, etc... If you read the Itanium ABI, you'll realise how large that is

Thankfully, the first block is (almost) lifted, thanks to the impressive dedication of Francois Pichet.

There is work ongoing (notably by r4start) to solve this ABI issue.

Also, Ruben Van Boxem has been working in parallel to port libc++ to Windows (at least partly).

The tasks are huge, and I mentionned 3 names; there are several others but not much; and this is *volunteer* work so they don't have much time per week.

CLang is primarily supported by Apple and Google and they don't seem too interested in Windows support/compatibility: they welcome it, and the developers will help, but they won't lead it.

Let's put the credit where it is due here because unfortunately Chandler does not make that clear enough.

Clang was invented by Apple by the compiler team managed by Chris Lattner. Clang was completely designed and written at Apple before it went open source so Google has nothing to do with the genesis of clang. Clang continues to be mainly developed by Apple as the rest of LLVM and Google only recently jumped in clang development as they started to use it internally for automatic C++ refactoring.

Extract both to the same directory to merge them for libraries & runtime dll's. Running clang++.exe seems to work excellent with and without the -std=c++0x command line flag to enable C++11 features like range-based for loops and auto. Lambda's aren't yet supported but the GCC included by downloading and merging both supports all new features noted here: http://gcc.gnu.org/projects/cxx0x.html

>LLVM (and clang, the C/C++/Objective-C front end), began as a project at UIUC, headed by Chris Lattner and Vikram Adve back in August of 2000.

>Apple hired Chris to head up their LLVM team in (I believe) early 2007, and Doug Gregor (from the U of Indiana) to head up their clang team a couple of years later.

LLVM started at UIUC. Chris was hired by Apple in 2005. Chris started development of clang while at Apple (and for the first few years, development was done almost entirely by the LLVM team at Apple). Chris's resume has a pretty good timeline, for those who are interested.

Remove this comment

Remove this thread

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.