fbpx
维基百科

Clang

Clang(发音为/ˈklæŋ/類似英文單字clang[4]) 是一個CC++Objective-CObjective-C++程式語言的編譯器前端。它採用了LLVM作為其後端,由LLVM2.6開始,一起釋出新版本。它的目標是提供一個GNU編譯器套裝(GCC)的替代品,支援了GNU編譯器大多數的編譯設定以及非官方語言的擴充功能。作者是克里斯·拉特納(Chris Lattner),在蘋果公司的贊助支持下進行開發,而原始碼授權是使用類BSD的伊利诺伊大学厄巴纳-香槟分校開源碼許可。

Clang
原作者克里斯·拉特納
開發者LLVM开发小组
当前版本
  • 17.0.3 (2023年10月17日;穩定版本)[1][2]
源代码库
  • github.com/llvm/llvm-project
编程语言C++
操作系统Unix-like
系統平台跨平台
类型編譯器
许可协议
  • 伊利诺伊大学厄巴纳-香槟分校開源碼許可(University of Illinois/NCSA Open Source License)
  • Apache License 2.0 with LLVM Exceptions (v9.0.0和之后的版本)[3]
网站clang.llvm.org 

Clang專案包括Clang前端和Clang靜態分析器等。[5]

概述 编辑

這個軟體專案在2005年由蘋果公司發起,是LLVM编译器工具集的前端(front-end),目的是输出代码对应的抽象语法树(Abstract Syntax Tree, AST),並將程式碼編譯成LLVM Bitcode。接著在後端(back-end)使用LLVM編譯成平台相关的機器語言 。Clang支持C、C++、Objective C。

在Clang語言中,使用Stmt来代表statement。Clang程式碼的单元(unit)皆為语句(statement),语法树的节点(node)类型就是Stmt。另外Clang的表达式(Expression)也是語句的一種,Clang使用Expr來代表Expression,Expr本身繼承自Stmt。节点之下有子节点列表(sub-node-list)。

Clang本身性能優異,其生成的AST所耗用掉的内存僅僅是GCC的20%左右。FreeBSD操作系统自2014年1月發行的10.0版本开始将Clang/LLVM作为默认编译器[6]

效能 编辑

測試證明Clang编译Objective-C代码时速度为GCC的3倍[7],還能針對使用者發生的編譯錯誤准确地给出建议[8]

版本歷史 编辑

這個表格只記錄了Clang歷史中特別的階段與版本

日期 要點
2007年7月11日 Clang前端以開放原始碼授權釋出
2009年2月25日 Clang/LLVM能夠編譯出可運作的FreeBSD核心。[9][10]
2009年3月16日 Clang/LLVM能夠編譯出可運作的DragonFly BSD核心。[11][12]
2009年10月23日 Clang 1.0首度與LLVM 2.6一起釋出。
2009年12月24日 產生的C和Objective-C程式碼達到產品品質(但C++和Objective-C++仍未完成)Clang C++能夠編譯GCC 4.2的libstdc++並為某些特定的程式產生可運作的程式碼,並可以編譯自身。[13]
2010年2月2日 Clang能夠自举英语Self-hosting[14]
2010年2月20日 經過修改後的HelenOS英语HelenOS能夠用Clang編譯,,並在IA-32上通過所有空間與使用者回歸測試。[15]
2010年5月20日 最新版的Clang成功建制Boost C++ Libraries,並且幾乎通過了所有測驗[16]
2010年6月10日 Clang/LLVM被整合在FreeBSD之中(但預設編譯器仍是GCC)[17]
2010年10月25日 Clang/LLVM能夠編譯可運作的Linux核心[18]
2011年1月26日 初步實現所有C++0x草案標準,其中少部分草案中的新特性也出現在開發版的Clang中。[19][20]
2011年2月10日 Clang能夠編譯出可運作的HotSpot Java虛擬機器
2012年2月28日 Clang 3.0能夠重建超過91%Debian成品。[21]
2012年2月29日 Clang成為MINIX 3中預設的編譯器。[22]
2012年5月12日 FreeBSD宣布Clang/LLVM將成為預設編譯器,取代沿用多年的GCC。[23]
2012年11月5日 Clang成為FreeBSD預設編譯器。[24]
2013年2月18日 Clang/LLVM能夠編譯出Nexus 7修改版可運作的Android Linux核心[25][26]
2013年4月19日 Clang完成所有C++11特性。[27]
2013年11月6日 Clang完成所有C++14特性。[28]

參考文獻 编辑

  1. ^ LLVM 17.0.3. [2023年10月17日]. 
  2. ^ LLVM 17.0.3 Released. [2023年10月17日]. 
  3. ^ The LLVM Project is under the Apache License v2.0 with LLVM Exceptions, llvm.org, [2021-02-03], (原始内容于2022-06-29) 
  4. ^ Christopher, Eric. . LLVMdev (邮件列表). 2008-07-03 [2008-07-09]. (原始内容存档于2012-02-08). 
  5. ^ Clang Static Analyzer. LLVM. [2009-09-03]. (原始内容于2011-10-08). 
  6. ^ FreeBSD 10.0-RELEASE Announcement. [2017-07-17]. (原始内容于2017-07-08). 
  7. ^ Chris Lattner. LLVM - 2.0 and beyond! (PDF). [2013-09-26]. (原始内容 (PDF)于2012-06-18). 
  8. ^ Amazing feats of Clang Error Recovery. [2013-09-26]. (原始内容于2010-07-02). 
  9. ^ Divacky, Roman. [ANNOUNCE] clang/llvm can compile booting FreeBSD kernel on i386/amd64. [2013-11-08]. (原始内容存档于2012-04-30). 
  10. ^ Building FreeBSD with Clang, Wiki.freebsd.org, 2012-08-24 [2012-09-18], (原始内容于2012-10-01) 
  11. ^ Hornung, Alex. llvm/clang once more. [2013-11-08]. (原始内容存档于2012-04-30). 
  12. ^ Clang, DragonFlyBSD, [2012-09-18], (原始内容于2012-10-05) 
  13. ^ Clang can compile LLVM and Clang. LLVM Project Blog. [2013-11-08]. (原始内容存档于2012-04-30). 
  14. ^ Clang Successfully Self-Hosts. LLVM Project Blog. [2013-11-08]. (原始内容存档于2012-04-30). 
  15. ^ HelenOS mainline changeset head,294. [2013-11-08]. (原始内容存档于2012-04-30). 
  16. ^ Gregor, Doug. Clang++ Builds Boost!. LLVM Project Blog. [2013-11-08]. (原始内容存档于2012-04-30). 
  17. ^ Davis, Brad. FreeBSD Status Reports April - June, 2010. [2013-11-08]. (原始内容存档于2012-04-30). 
  18. ^ , Lists.cs.uiuc.edu, [2012-09-18], (原始内容存档于2015-09-07) 
  19. ^ Gregor, Douglas. (邮件列表). 26 January 2011 [29 January 2011]. (原始内容存档于2011年1月30日). 
  20. ^ C++ and C++'0x Support in Clang. LLVM. [2013-11-08]. (原始内容于2019-05-28). 
  21. ^ Ledru, Sylvestre. Rebuild of the Debian archive with clang. [2013-11-08]. (原始内容存档于2012-06-18). 
  22. ^ . [2013-11-08]. (原始内容存档于2015-11-28). 
  23. ^ Gerzo, Daniel. FreeBSD Quarterly Status Report January-March, 2012 (邮件列表). 12 May 2012 [14 May 2012]. (原始内容存档于2012-06-30). 
  24. ^ Davis, Brooks. HEADS UP: Clang now the default on x86 (邮件列表). 5 November 2012 [7 November 2012]. (原始内容于2013-11-22). 
  25. ^ Webster, Behan. (PDF). 18 February 2013 [11 May 2013]. (原始内容 (PDF)存档于2014-05-12). 
  26. ^ Tinti, Vinicius. . 17 March 2013 [11 May 2013]. (原始内容存档于2014-06-11). 
  27. ^ Du Toit, Stefanus. Clang is C++11 feature complete as of *just now*!. [2013-11-08]. (原始内容于2019-09-24). 
  28. ^ . [2013-11-08]. (原始内容存档于2017-01-30). 

外部連結 编辑

clang, 发音为, ˈklæŋ, 類似英文單字clang, 是一個c, objective, c和objective, 程式語言的編譯器前端, 它採用了llvm作為其後端, 由llvm2, 6開始, 一起釋出新版本, 它的目標是提供一個gnu編譯器套裝, 的替代品, 支援了gnu編譯器大多數的編譯設定以及非官方語言的擴充功能, 作者是克里斯, 拉特納, chris, lattner, 在蘋果公司的贊助支持下進行開發, 而原始碼授權是使用類bsd的伊利诺伊大学厄巴纳, 香槟分校開源碼許可, 原作者克里斯, 拉特納. Clang 发音为 ˈklaeŋ 類似英文單字clang 4 是一個C C Objective C和Objective C 程式語言的編譯器前端 它採用了LLVM作為其後端 由LLVM2 6開始 一起釋出新版本 它的目標是提供一個GNU編譯器套裝 GCC 的替代品 支援了GNU編譯器大多數的編譯設定以及非官方語言的擴充功能 作者是克里斯 拉特納 Chris Lattner 在蘋果公司的贊助支持下進行開發 而原始碼授權是使用類BSD的伊利诺伊大学厄巴纳 香槟分校開源碼許可 Clang原作者克里斯 拉特納開發者LLVM开发小组当前版本17 0 3 2023年10月17日 穩定版本 1 2 源代码库github wbr com wbr llvm wbr llvm project编程语言C 操作系统Unix like系統平台跨平台类型編譯器许可协议伊利诺伊大学厄巴纳 香槟分校開源碼許可 University of Illinois NCSA Open Source License Apache License 2 0 with LLVM Exceptions v9 0 0和之后的版本 3 网站clang wbr llvm wbr org Clang專案包括Clang前端和Clang靜態分析器等 5 目录 1 概述 2 效能 3 版本歷史 4 參考文獻 5 外部連結概述 编辑這個軟體專案在2005年由蘋果公司發起 是LLVM编译器工具集的前端 front end 目的是输出代码对应的抽象语法树 Abstract Syntax Tree AST 並將程式碼編譯成LLVM Bitcode 接著在後端 back end 使用LLVM編譯成平台相关的機器語言 Clang支持C C Objective C 在Clang語言中 使用Stmt来代表statement Clang程式碼的单元 unit 皆為语句 statement 语法树的节点 node 类型就是Stmt 另外Clang的表达式 Expression 也是語句的一種 Clang使用Expr來代表Expression Expr本身繼承自Stmt 节点之下有子节点列表 sub node list Clang本身性能優異 其生成的AST所耗用掉的内存僅僅是GCC的20 左右 FreeBSD操作系统自2014年1月發行的10 0版本开始将Clang LLVM作为默认编译器 6 效能 编辑測試證明Clang编译Objective C代码时速度为GCC的3倍 7 還能針對使用者發生的編譯錯誤准确地给出建议 8 版本歷史 编辑這個表格只記錄了Clang歷史中特別的階段與版本 日期 要點000000002007 07 11 0000 2007年7月11日 Clang前端以開放原始碼授權釋出000000002009 02 25 0000 2009年2月25日 Clang LLVM能夠編譯出可運作的FreeBSD核心 9 10 000000002009 03 16 0000 2009年3月16日 Clang LLVM能夠編譯出可運作的DragonFly BSD核心 11 12 000000002009 10 23 0000 2009年10月23日 Clang 1 0首度與LLVM 2 6一起釋出 000000002009 12 24 0000 2009年12月24日 產生的C和Objective C程式碼達到產品品質 但C 和Objective C 仍未完成 Clang C 能夠編譯GCC 4 2的libstdc 並為某些特定的程式產生可運作的程式碼 並可以編譯自身 13 000000002010 02 02 0000 2010年2月2日 Clang能夠自举 英语 Self hosting 14 000000002010 02 20 0000 2010年2月20日 經過修改後的HelenOS 英语 HelenOS 能夠用Clang編譯 並在IA 32上通過所有空間與使用者回歸測試 15 000000002010 05 20 0000 2010年5月20日 最新版的Clang成功建制Boost C Libraries 並且幾乎通過了所有測驗 16 000000002010 06 10 0000 2010年6月10日 Clang LLVM被整合在FreeBSD之中 但預設編譯器仍是GCC 17 000000002010 10 25 0000 2010年10月25日 Clang LLVM能夠編譯可運作的Linux核心 18 000000002011 01 26 0000 2011年1月26日 初步實現所有C 0x草案標準 其中少部分草案中的新特性也出現在開發版的Clang中 19 20 000000002011 02 10 0000 2011年2月10日 Clang能夠編譯出可運作的HotSpot Java虛擬機器000000002012 02 28 0000 2012年2月28日 Clang 3 0能夠重建超過91 Debian成品 21 000000002012 02 29 0000 2012年2月29日 Clang成為MINIX 3中預設的編譯器 22 000000002012 05 12 0000 2012年5月12日 FreeBSD宣布Clang LLVM將成為預設編譯器 取代沿用多年的GCC 23 000000002012 11 05 0000 2012年11月5日 Clang成為FreeBSD預設編譯器 24 000000002013 02 18 0000 2013年2月18日 Clang LLVM能夠編譯出Nexus 7修改版可運作的Android Linux核心 25 26 000000002013 04 19 0000 2013年4月19日 Clang完成所有C 11特性 27 000000002013 11 06 0000 2013年11月6日 Clang完成所有C 14特性 28 參考文獻 编辑 LLVM 17 0 3 2023年10月17日 LLVM 17 0 3 Released 2023年10月17日 The LLVM Project is under the Apache License v2 0 with LLVM Exceptions llvm org 2021 02 03 原始内容存档于2022 06 29 Christopher Eric simply wonder pronunciation of Clang LLVMdev 邮件列表 2008 07 03 2008 07 09 原始内容存档于2012 02 08 Clang Static Analyzer LLVM 2009 09 03 原始内容存档于2011 10 08 FreeBSD 10 0 RELEASE Announcement 2017 07 17 原始内容存档于2017 07 08 Chris Lattner LLVM 2 0 and beyond PDF 2013 09 26 原始内容存档 PDF 于2012 06 18 Amazing feats of Clang Error Recovery 2013 09 26 原始内容存档于2010 07 02 Divacky Roman ANNOUNCE clang llvm can compile booting FreeBSD kernel on i386 amd64 2013 11 08 原始内容存档于2012 04 30 Building FreeBSD with Clang Wiki freebsd org 2012 08 24 2012 09 18 原始内容存档于2012 10 01 Hornung Alex llvm clang once more 2013 11 08 原始内容存档于2012 04 30 Clang DragonFlyBSD 2012 09 18 原始内容存档于2012 10 05 Clang can compile LLVM and Clang LLVM Project Blog 2013 11 08 原始内容存档于2012 04 30 Clang Successfully Self Hosts LLVM Project Blog 2013 11 08 原始内容存档于2012 04 30 HelenOS mainline changeset head 294 2013 11 08 原始内容存档于2012 04 30 Gregor Doug Clang Builds Boost LLVM Project Blog 2013 11 08 原始内容存档于2012 04 30 Davis Brad FreeBSD Status Reports April June 2010 2013 11 08 原始内容存档于2012 04 30 Clang builds a working Linux Kernel Boots to RL5 with SMP networking and X self hosts Lists cs uiuc edu 2012 09 18 原始内容存档于2015 09 07 Gregor Douglas New C 0x feature support in Clang 邮件列表 26 January 2011 29 January 2011 原始内容存档于2011年1月30日 C and C 0x Support in Clang LLVM 2013 11 08 原始内容存档于2019 05 28 Ledru Sylvestre Rebuild of the Debian archive with clang 2013 11 08 原始内容存档于2012 06 18 Official Minix 3 website News 2013 11 08 原始内容存档于2015 11 28 Gerzo Daniel FreeBSD Quarterly Status Report January March 2012 邮件列表 12 May 2012 14 May 2012 原始内容存档于2012 06 30 Davis Brooks HEADS UP Clang now the default on x86 邮件列表 5 November 2012 7 November 2012 原始内容存档于2013 11 22 Webster Behan LLVMLinux Compiling Android with LLVM PDF 18 February 2013 11 May 2013 原始内容 PDF 存档于2014 05 12 Tinti Vinicius LLVMLinux Nexus 7 17 March 2013 11 May 2013 原始内容存档于2014 06 11 Du Toit Stefanus Clang is C 11 feature complete as of just now 2013 11 08 原始内容存档于2019 09 24 llvm project Revision 194194 2013 11 08 原始内容存档于2017 01 30 外部連結 编辑官方网站 LLVMdev New LLVM C front end clang announcement 11 July 2007 Presentation Ted Kremenek Finding Bugs with the Clang Static Analyzer Slides 页面存档备份 存于互联网档案馆 Presentation Steve Naroff Clang Internals Slides 页面存档备份 存于互联网档案馆 2009 DevMtg Clang presentation 页面存档备份 存于互联网档案馆 取自 https zh wikipedia org w index php title Clang amp oldid 78335521, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。