On 1 Apr 2009, at 01:51, Pete French wrote:

Apple has moved away from GCC so you can no longer depend on them.

This I did not know. Interesting. I assumed Xcode was still using
gcc.

XCode currently ships with gcc and llvm-gcc. Only llvm-gcc is supported for iPhone developement (if you take a look at the LLVM commit logs, you'll notice a massive amount of ARM-backend code was committed the day the first iPhone developer kits were released).

llvm-gcc is a hybrid compiler, which uses GCC to parse, then translates GIMPLE (the GCC intermediate representation) into LLVM IR and then uses LLVM for optimisation and code generation. Because it includes parts of GCC, it is GPL'd.

Unfortunately for us, llvm-gcc uses Apple's branch of GCC, which is GPLv2, and (more importantly) only supports the Apple runtime. You can use it with to compile C and C++ code on non-Apple platforms, but you can't use it with Objective-C, so GNUstep can't use it.

Clang is a new front-end for LLVM, written completely from scratch, which is more-or-less feature complete for C99 and Objective-C 2 (parsing anyway - code generation is only finished for the Apple runtimes), and now working towards C++ support.

My understanding is that Apple intends to drop llvm-gcc once clang is a drop-in replacement (it almost is now for C and Objective-C on the Apple runtimes, but it's still probably about a year away from being ready for C++ / ObjC++).

There are a few other reasons why clang might interest the GNUstep community:

- It contains a static analyser, which can find a lot of different types of Objective-C bug.

- It is built from several libraries, which means that you can easily reuse the parser in other programs, for example to implement code completion and syntax highlighting, or to write a version of autogsdoc that is aware of macros.

- One of the demos is a rewriter, which translates ObjC code into pure C code (for the Apple runtime). Modifying this to use the GNU runtime calls would give a mechanism for compiling GNUstep on any platform with a working C compiler. Alternatively, LLVM has a C back end which can generate (completely unreadable, but semantically valid) C code from the IR.

If you want an overview of LLVM, you can read this article:

http://www.informit.com/articles/article.aspx?p=1215438

David


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to