在使用xcode时常常会遇到这2个概念,今天总结一下。

wiki中关于llvm的描述:

LLVM提供了完整編譯系統的中間層,它會將中間語言(IF, Intermediate form)從編譯器取出與最佳化,最佳化後的IF接著被轉換及鏈結到目標平台的汇编语言。LLVM可以接受來自GCC工具鏈所編譯的IF,包含它底下現存的編譯器。

请参考以下链接,http://www.weiphone.com/apple/blog/2009-09-27/The_heart_of_Snow_Leopard_LLVM_and_Clang_206356.shtml

Clang 和 LLVM 的更多资料,请参看官方文档,http://llvm.org    http://clang.llvm.org

以下是clang tools的简要介绍

DESCRIPTION
clang is a C, C++, and Objective-C compiler which encompasses preprocessing, parsing, optimization, code
generation, assembly, and linking. Depending on which high-level mode setting is passed, Clang will stop
before doing a full link. While Clang is highly integrated, it is important to understand the stages of
compilation, to understand how to invoke it. These stages are:

Driver
The clang executable is actually a small driver which controls the overall execution of other tools
such as the compiler, assembler and linker. Typically you do not need to interact with the driver, but
you transparently use it to run the other tools.

Preprocessing
This stage handles tokenization of the input source file, macro expansion, #include expansion and
handling of other preprocessor directives. The output of this stage is typically called a ".i" (for
C), ".ii" (for C++), ".mi" (for Objective-C) , or ".mii" (for Objective-C++) file.

Parsing and Semantic Analysis
This stage parses the input file, translating preprocessor tokens into a parse tree. Once in the form
of a parser tree, it applies semantic analysis to compute types for expressions as well and determine
whether the code is well formed. This stage is responsible for generating most of the compiler warnings
as well as parse errors. The output of this stage is an "Abstract Syntax Tree" (AST).

Code Generation and Optimization
This stage translates an AST into low-level intermediate code (known as "LLVM IR") and ultimately to
machine code. This phase is responsible for optimizing the generated code and handling target-specific
code generation. The output of this stage is typically called a ".s" file or "assembly" file.

Clang also supports the use of an integrated assembler, in which the code generator produces object
files directly. This avoids the overhead of generating the ".s" file and of calling the target
assembler.

Assembler
This stage runs the target assembler to translate the output of the compiler into a target object file.
The output of this stage is typically called a ".o" file or "object" file.

Linker
This stage runs the target linker to merge multiple object files into an executable or dynamic library.
The output of this stage is typically called an "a.out", ".dylib" or ".so" file.

The Clang compiler supports a large number of options to control each of these stages. In addition to
compilation of code, Clang also supports other tools:

Clang Static Analyzer

The Clang Static Analyzer is a tool that scans source code to try to find bugs through code analysis. This
tool uses many parts of Clang and is built into the same driver.

LLVM,Clang的更多相关文章

  1. LLVM每日谈21 一些编译器和LLVM/Clang代码

    作者:闪亮宁(snsn1984) 一些自己的收藏LLVM/Clang代码,而他自己写一些一点点LLVM/Clang译器的代码.在这里把这些代码库分享出来,欢迎大家交流探讨. 1.crange http ...

  2. llvm+clang编译安装

    最近一段时间在llvm+clang上做一些东西,所以顺便将自己如何编译安装llvm+clang写了篇文章发在这里,希望能帮助刚接触llvm+clang的童鞋少走一些弯路(我刚接触的时候为了编译安装这个 ...

  3. Sublime Text3 & MinGW & LLVM CLang 安装配置C-C++编译环境

    Sublime Text是一款强大的跨平台代码编辑器,小巧而且丰富实用的功能是Visual Studio不能比拟的,但是编译运行是一个软肋,本文通过在sublime中配置g++编译器实现程序的编译功能 ...

  4. Objective-C中的self与LLVM Clang新引入的instancetype

    我们知道,大部分面向对象语言对于一个类的成员方法都有一个隐含的参数.在C++.Java.C#和JavaScript中是this,而在Objective-C中则是self.当然,由于Objective- ...

  5. Linux c++ vim环境搭建系列(2)——Ubuntu18.04.4编译安装llvm clang

    2. 源码编译安装llvm clang 参考网址: https://llvhttps

  6. 编译llvm+clang

    第一步,下载llvm代码: git clone git@github.com:llvm-mirror/llvm.git 第二步,进入llvm/tools目录并下载clang代码 cd llvm/too ...

  7. Windows 7 X64平台编译LLVM+clang

    1 源码包 去LLVM官方网站下载最新的源码,Windows平台下载三个即可(2019.04.24版本为LLVM 8.0.0): LLVM source code (.sig) Clang sourc ...

  8. LLVM/Clang编译相关研究

    https://blog.csdn.net/guojin08/article/details/54310858 https://juejin.im/entry/5c64da44518825620b45 ...

  9. 在Linux下使用LLVM Clang以及Blocks

    可以从这个链接下载:http://llvm.org/releases/download.html sudo apt-get install llvm sudo apt-get install clan ...

随机推荐

  1. Ibatis -- 一次执行多条SQL

    <statement id="DeleteAccount" parameterClass="Account"> BEGIN DELETE FROM ...

  2. nmap常用命令

    1) 获取远程主机的系统类型及开放端口 nmap -sS -P0 -sV -O <target> 这里的 < target > 可以是单一 IP, 或主机名,或域名,或子网 - ...

  3. BZOJ-3576 江南乐 博弈+优化

    fye测试原题,高一全跪,高二学长除了CA爷似乎都A辣(逃) 3576: [Hnoi2014]江南乐 Time Limit: 30 Sec Memory Limit: 512 MB Submit: 1 ...

  4. BZOJ-1822 Frozen Nova 冷冻波 计(jie)算(xi)几何+二分+最大流判定+经典建图

    这道逼题!感受到了数学对我的深深恶意(#‵′).... 1822: [JSOI2010]Frozen Nova 冷冻波 Time Limit: 10 Sec Memory Limit: 64 MB S ...

  5. maven 热部署成功案列

    首先配置tomcat-user.xml,这个文件是在tomcat的conf文件夹下面 在</tomcat-users>前添加这段 <role rolename="admin ...

  6. Mac OS下编写对拍程序

    介绍 对拍是信息学竞赛中重要的技巧,它通过一个效率低下但正确率可以保证的程序,利用庞大的随机生成数据来验证我们的高级算法程序.对拍最大的优势在于可以通过人力所不能及的速度和数量达到验证的效果.下面我们 ...

  7. boost(barrier)

    barrier:栅栏的意思,当barrier bar(3),这三个线程会放到栅栏中,等第三个线程执行时一起唤醒,然后返回 barrier barrier类的接口定义如下: class barrier ...

  8. pom.xml

    使用intelJ idea 导入maven包管理文件是,使用Import的方式导入,会自动导入pom.xml来导入包. pom.xml会指定父子关系. 例如,总模块的pom.xml中有一下内容: &l ...

  9. webshell提权20种思路

    1,SER-TU提权(通常是利用SERFTP服务器管理工具,首先要在安装目录下找到INI配置文件,必须具备可写入的权限)2,RADMIN提权(大家并不陌生,我们在扫描4899空口令后,同样需要他来连接 ...

  10. 兼容amd,commonjs和browser的模块写法

    从uuid.js中抽出来的写法. (function() { var _global = this; // Export public API var obj = {}; obj.attr = fun ...