Xcode 3.2.1 GCC CLANG和LLVM解析 [英] Xcode 3.2.1 GCC CLANG and LLVM demystification

查看:132
本文介绍了Xcode 3.2.1 GCC CLANG和LLVM解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

本周新版Xcode 3.2.1中的自述文件说明如下:

The readme included with the new Xcode 3.2.1 this week says the following:


  • 静态代码分析完全集成在Xcode IDE

  • GCC 4.2是10.6 SDK的默认系统编译器

  • 使用两个不同的前端包括可选的LLVM编译器--Clang编译器是一个前沿解析器,提供显着改进的编译时间。为了最大程度的兼容性,GCC LLVM编译器将LLVM后端与GCC 4.2解析器结合使用。

  • 新的可选Clang-LLVM 1.0编译器使用更快的Clang前端解析器用于快速编译的LLVM后端编译器和快速可执行代码。许多项目将受益于此编译器组合,虽然GCC 4.2仍然是系统默认值。

  • Static code analysis is fully integrated within the Xcode IDE via the Build and Analyze option under the Build menu or via custom build settings
  • GCC 4.2 is the default system compiler for the 10.6 SDK
  • The optional LLVM compiler is included using two different front ends - the Clang compiler is a leading-edge parser that offers dramatically improved compile times. For maximum compatibility, the GCC LLVM compiler utilizes the LLVM back-end with the GCC 4.2 parser.
  • New optional Clang-LLVM 1.0 compiler uses the much faster Clang front-end parser coupled with the LLVM back-end compiler for fast compiles and fast executable code. Many projects will benefit from this compiler combination, although GCC 4.2 is still the system default. The Clang-LLVM 1.0 compiler will fall back to using LLVM-GCC 4.2 when it encounters C++ code.

我们公司现有的项目包括:是纯C,Objective-C和Objective-C ++的桌面和iphone。有人可以在高层次总结LLVM,GCC,CLANG,CLANG-LLVM,WordFoo等之间的差异。 et al。并解释他们是什么,什么时候我们应该使用每个和什么?

Our company has existing projects that are pure C, Objective-C, and Objective-C++ for desktop and iphone. Can someone summarize at a high-level the differences between LLVM, GCC, CLANG, CLANG-LLVM, WordFoo et. al. and explain what they are and when we should be using each and for what? It would be nice to have links to more a detailed explanation, but I'm really just looking for a high-level overview.

推荐答案

编译器基本上分为两部分。一个是包含编程语言的解析器和语义分析的前端。前端生成某种中间代码的代码。

Compilers are basically split into two parts. One being the front-end that contains the parser and semantic analysis for the programming language. The front-end produces some kind of intermediate representation of your code. Then there's the backend which takes the stuff the front-end produced, optimizes it, and eventually generates assembly code.


  • GCC :众所周知的编译器,包含各种语言的前端和许多处理器体系结构的后端

  • LLVM :用于各种架构(和其他低级内容)的一组后端

  • clang :C的新前端,Objective-C ,和C ++;使用LLVM后端。你将从编译器获得更多的可读错误和警告,并缩短编译时间。您可能也会遇到不兼容或错误; clang是一个非常年轻的项目。

  • LLVM-GCC:GCC的前端与LLVM的后端。 LLVM的后端比GCC的后端快。

  • GCC: well known compiler, contains both front-ends for various languages and back-ends for many processor architectures
  • LLVM: a set of back-ends for various architectures (and other low-level stuff)
  • clang: a new front-end for C, Objective-C, and C++; uses the LLVM back-ends. You'll get more readable errors and warnings from your compiler and shorter compile times. You might also encounter incompatibilities or bugs; clang is a very young project.
  • LLVM-GCC: GCC's front-end with LLVM's back-end. LLVM's back-end is faster than GCC's.

clang(Objective-)C ++支持远未完成,所以它调用llvm-gcc当它遇到一个C ++源文件。它还包含现在集成到Xcode中的静态分析器。有些人说,LLVM的后端生成比GCC更好的代码,但你的里程可能不同。 LLVM还支持链接时优化(您可以在Xcode的项目设置中启用)。他们可能会产生更快的代码。

clang's (Objective-)C++ support is far from being complete so it calls llvm-gcc when it encounters a C++ source file. It also contains the static analyzer that is now integrated into Xcode. Some people say LLVM's back-end generates better code than GCC's but your mileage may vary. LLVM also supports link-time optimizations (which you can enable in Xcode's project settings). They may produce faster code.

苹果想要在未来替换GCC铛,因为他们有一个政策反对GPLv3许可代码(GCC 4.2是最后一个版本, GPLv2)。

Apple wants to replace GCC with clang in the future because they have a policy against GPLv3 licensed code (GCC 4.2 is the last version that's licensed under GPLv2).

这篇关于Xcode 3.2.1 GCC CLANG和LLVM解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆