User forums > General (but related to Code::Blocks)
Integration with LLVM/clang
JohnBaptist:
Hello there. I was wondering if there are currently any plans to integrate Code::Blocks into the LLVM/clang modular compiler framework. It seems to me that it would be great to take advantage of its static analysis and debugging features in an IDE like Code::Blocks. If there is already such an effort underway, I'd love to contribute. If not, I think we (meaning me and you and other people) should get cracking on this. I have a hunch that five years from now we'll all be using LLVM, and gcc will be a distant memory. Who's with me?
This post might perhaps more properly belong in the section for developers.
J
stahta01:
I suggest posting a link to download a working compiler.
And stating what OS it requires.
Tim S.
JohnBaptist:
Okay, as you wish.
LLVM/clang currently works on most of the more popular *nix variants. It's shipped by default with MacOS X 10.6 (and is the current recommended compiler). It's available as a binary download in the Ubuntu repositories. The FreeBSD project has recently decided to use it as its primary compiler for all ports and the kernel, totally replacing gcc. It may be available in repositories for other operating systems as well. It also allegedly works under Windows, but I haven't tested this.
The official web page is here: http://clang.llvm.org/
Information about building from source is here: http://clang.llvm.org/get_started.html
A comparison (biased, obviously, but fairly objective) with gcc is here: http://clang.llvm.org/comparison.html
From my perspective as a developer, LLVM/clang offers a lot of advantages over the gcc suite. It has much more advanced static analysis features and better error reporting. It's capable of graphically showing flow control errors (for example, a function that should but doesn't return a value), as is currently done in XCode. It compiles faster than gcc, uses less memory, and produces faster code.
From the perspective of a developer of IDEs, LLVM/clang is also easier to work with than gcc, since it provides its services through a well-defined, modular API. So, using it could theoretically reduce the duplication of effort that an IDE like Code::Blocks must do, to, for example, parse source code. Instead of parsing it itself, it could just rely on the compiler's parser engine to provide parsed data.
To be honest, I think this is the way forward. gcc has been around forever and is a great compiler but it's monolithic and crufty and isn't going to solve any of its severe design problems. I think we would be remiss if we didn't develop an IDE for *nix platforms that takes advantage of LLVM/clang. If there is no current project to do this, I would like to assemble a team to work on a branch of Code::Blocks with this end in mind. Any takers?
oBFusCATed:
Have you tested the C++ part of clang? Can someone compile boost or any other mega hyper giga c++ project with it?
Most of the people here are interested in c++. An c++ is not the top priority for Apple, the main driving force behind llvm/clang.
Last time I've checked c++, wasn't supported at 100% .
But for one thing you're right, there is no need to rewrite the c/c++/objc/objc++ parser for the various code completion/refactoring tools needed by the IDE.
Clang some day will provide them and they would have been tested and working and fast. So any IDE can benefit from their work.
Another thing to have in mind is the license compatibility between C::B and clang -> GPL3 and the LLVM license.
Are they compatible? Can C::B link to llvm/clang libs?
I don't understand licenses much, so I can't tell, we need a lawyer or someone who understands the GPL.
If your desire is to use clang as compiler it should be fairly easy (I think), because they try to be compatible to gcc, so the migration is easier for developers.
Best regards...
JohnBaptist:
The C++ part of clang works fine based on my non-thorough experiments. I don't know if it works with Boost or the STL yet, but this being worked on, and the fact that work is not complete shouldn't dissuade us from implementing support for the compiler in Code::Blocks. We should get started now, so that when it is finished, this will be the first fully *nix-based IDE that fully supports LLVM/clang.
Yes, clang has a drop-in gcc replacement front-end, so that all projects that assume gcc can work with clang with no modifications. That should work with Code::Blocks as-is. However, I'd like to extend Code::Blocks to take advantage of the more advanced features of clang. Take a look at the following screen shot (from http://developer.apple.com/mac/library/featuredarticles/StaticAnalysis/index.html):
http://developer.apple.com/mac/library/featuredarticles/StaticAnalysis/Art/uninitialized.jpg
It would be nice if the Code::Blocks GUI supported that kind of static analysis. I have long-standing resentment of Mac users and I would be deeply grieved if they were allowed to have a superior development environment.
clang is distributed on the BSD license, which is compatible with GPL insofar as GPL projects may incorporate BSD projects (but not the other way around). There are lots of similarly-licensed projects that have no problem co-existing with GPL projects. So, yes, Code::Blocks can certainly link to LLVM/clang modules and so forth.
Navigation
[0] Message Index
[#] Next page
Go to full version