Clang/LLVM, eine Alternative zu gcc



Ähnliche Dokumente
Software-Engineering und Optimierungsanwendungen in der Thermodynamik

Der C Compiler C - GRUNDLAGEN UND KONZEPTE - COMPILER - FEDERICO ARDILA 1/20

Informatik für den Satellitenbau. Toolchains und Crosscompiler

Software-Engineering Grundlagen des Software-Engineering

Embedded-Linux-Seminare. Toolchains

Oracle VM Support und Lizensierung. best Open Systems Day April Unterföhring. Marco Kühn best Systeme GmbH

arlanis Software AG SOA Architektonische und technische Grundlagen Andreas Holubek

OpenSecurity Open Source Sicherheitslösungen schützen Angestellte und Daten in öffentlichen Institutionen. Das Projekt Das Produkt

C++ mit Eclipse & GCC unter Windows

Programmentwicklung ohne BlueJ

Kompilieren und Linken

Faclets. Eine alternative View Technologie um JSF Applikationen OHNE JSP zu entwickeln Wird unter java.net gehostet Open Source, CDDL Lizenz

Buildsystem. Maven & Scons. Controls Entwicklungsforum Januar 2012

Nuetzlicher Kleinkram

Javadoc. Programmiermethodik. Eva Zangerle Universität Innsbruck

ATHOS Benutzertreffen

Übersicht. Eclipse Foundation. Eclipse Plugins & Projects. Eclipse Ganymede Simultaneous Release. Web Tools Platform Projekt. WSDL Editor.

I.1 Die Parrot Assemblersprache

4D Server v12 64-bit Version BETA VERSION

OpenStack in der Praxis

Eclipse User Interface Guidelines

miditech 4merge 4-fach MIDI Merger mit :

1.1 VoIP - Kein Notruf möglich. 1.2 VoIP - Vorrang von Notrufen

Softwarelizenzen und Open Source

GuiXT und mysap ERP. Regensdorf, April 2004 Dr.Gerhard Rodé, Synactive GmbH

Version 0.3. Installation von MinGW und Eclipse CDT

Vorlesung Objektorientierte Softwareentwicklung. Kapitel 0. Java-Überblick

DLLs (dynamic loaded libraries) mit MingW erstellen

Leistungsfähige ARM CPUs für den industriellen Einsatz

C ++ in der Computerlinguistik

MO 27. Aug. 2007, 17:00 UHR JAVA FRAMEWORKS TIPPS VON PROFI-GÄRTNERN GEGEN WILDWUCHS

Effizient, sicher und flexibel: Desktop-Virtualisierung mit Citrix XenDesktop

Einführung in die Systemprogrammierung

Diplomarbeit Antrittsvortrag

Cloud Architektur Workshop

Abacus Formula Compiler (AFC)

Technische Anwendungsbeispiele

Virtueller Campus. Virtueller Campus Horw mit interaktiver Steuerung. HowTo: Externe Bibliotheken

Workshop: Eigenes Image ohne VMware-Programme erstellen

Einführung zu den Übungen aus Softwareentwicklung 1

DIGICOMP OPEN TUESDAY AKTUELLE STANDARDS UND TRENDS IN DER AGILEN SOFTWARE ENTWICKLUNG. Michael Palotas 7. April GRIDFUSION

Profiling und Coverage mit GNU und Bare Embedded Systems

Einführung in wxwidgets & wxdev-c++

Python SVN-Revision 12

Android-Testautomatisierung mit Robotium

C++11 ist da. Und jetzt?

Freie Software. Karin Kosina Free Software Foundation Europe.

0. Einführung. C und C++ (CPP)

TinyMCE. Frederik Leidloff

Embedded So)ware. Einrichten der Arbeitsumgebung

schnell und portofrei erhältlich bei beck-shop.de DIE FACHBUCHHANDLUNG mitp/bhv

ECLIPSE PLUG-IN. Redwood Anwendertage 2015

Übung: Verwendung von Java-Threads

Sehr geehrte Faktor-IPS Anwender,

Algorithms for graph visualization

GATE General Architecture for Text Engineering. Alexander Hein & Erik Dießler (VL Text Analytics )

2. ERSTELLEN VON APPS MIT DEM ADT PLUGIN VON ECLIPSE

Schreiben auf Englisch

Albert HAYR Linux, IT and Open Source Expert and Solution Architect. Open Source professionell einsetzen

Open Source. Hendrik Ebbers 2015

Vorkurs Informatik WiSe 15/16

Daten haben wir reichlich! The unbelievable Machine Company 1

OSS & Cloud Computing: der Motor für das Geoportal Bund

Gforth EC auf dem NXT Brick

25 Import der Beispiele

Lösungen zum 2. Komplex

How To: Wie entwickle ich mit SharpDevelop Anwendungen für die PocketPC-Platform

Starten Sie Eclipse: Hier tragen sie Ihr Arbeitsverzeichnis ein. Zu Hause z.b. c:\workspace.

Eclipse und Java Einheit 06: Building Eclipse Projete mit Ant

Für AX 4.0, den letzten Hotfix rollup einspielen. Der Hotfix wurde das erste Mal im Hotfix rollup eingeschlossen:

Programmentwicklung mit C++ (unter Unix/Linux)

Rapide An Event-Based Architecture Definition Language

7/15/2014. Stratus everrun Enterprise. Ist die Audio Qualität OK? Fragen bitte per Chat, diese werden im Anschluss beantwortet.

Vortrag SASS Funktionen #ck2016. Was ist SASS?

Einführung in Eclipse und Java

Installation der SAS Foundation Software auf Windows

Aufbau eines IT-Servicekataloges am Fallbeispiel einer Schweizer Bank

Private IaaS Cloud mit OpenStack. Sebastian Zielenski Linux/Unix Consultant & Trainer B1 Systems GmbH zielenski@b1-systems.de

Teil IV Die Programmiersprache C++

1. Übung zu "Numerik partieller Differentialgleichungen"

VO Projektmanagement

MOBILE ON POWER MACHEN SIE IHRE ANWENDUNGEN MOBIL?!

Business Breakfast. Ludwigshafen, 11. Juni SHE Informationstechnologie AG 2015

Werkzeuggestützte Softwareprüfungen Statische Analyse und Metriken

Freie Software. und ihre Unentbehrlichkeit in der modernen Informationsgesellschaft. Torsten Grote

Cross-Platform Mobile mit.net

BartPE. Dokumentation. Projektarbeit Network Services. Dozent: Wolf-Fritz Riekert. Belmondo Kovac. Autor: Andreas Dinkelacker, 3.

Bewertung der Methoden zur Sicherung von virtuellen Maschinen (VMware, Hyper-V) Ein Erfahrungsbericht

Ein Überblick über KDevelop

Open Source Software. Workshop : Open Source Software 3. Mannheimer Fachtag Medien Referent : Christopher Wieser (

Software Engineering. Zur Architektur der Applikation Data Repository. Franz-Josef Elmer, Universität Basel, HS 2015

Debugging in Magento

Kurzanleitung Installation der Zend Studio Sprachpakete

.NET Code schützen. Projekt.NET. Version 1.0

Installation einer C++ Entwicklungsumgebung unter Windows --- TDM-GCC und Eclipse installieren

FreieSoftwareOG. Creative Commons und freie Lizenzen- Ein kurzer Überblick

Java Kurs für Anfänger LMU SS09 Einheit 1 Javaumgebung

TYPO3 CMS 6.2 LTS. Die neue TYPO3- Version mit Langzeit- Support

Virtuelle Maschinen. Serbest Hammade / Resh. Do, 13. Dezember 2012

Die Plattform für Ihre Datenfabrik unabhängig von Ort und Zeit

Transkript:

Clang/LLVM, eine Alternative zu gcc V 1.1 Hans Buchmann Institut für Mikroelektronik IME Fachhochschule Nordwestschweiz FHNW hans.buchmann@fhnw.ch 27.August 2013 H.Buchmann Clang/LLVM 1 / 18

Ein Zwerg auf den Schultern eines Riesen Lessing J. Rosenwald Collection,1410 einmal mehr H.Buchmann Clang/LLVM 2 / 18

Ein Zwerg auf den Schultern eines Riesen /L ng M LV un r se Th a em H.Buchmann a Cl Lessing J. Rosenwald Collection,1410 einmal mehr Clang/LLVM 2 / 18

Die Compiler Fauna GNU Compiler Collection: gcc.gnu.org LLVM Compiler Infrastructure: llvm.org H.Buchmann Clang/LLVM 3 / 18

Die Compiler Fauna Seit 1987 170 Releases aktuell 4.8.1 494 Mitarbeiter 39 Targets (backends) Geschrieben in C/C++ Lizenz: GPL Seit 2003 24 Releases aktuell 3.3 340 Mitarbeiter 14 Targets (backends) Geschrieben in C++ Lizenz: University of Illinois/NCSA Open Source License BSD Style H.Buchmann Clang/LLVM 3 / 18

Die Compiler Fauna Seit 1987 170 Releases aktuell 4.8.1 494 Mitarbeiter 39 Targets (backends) Geschrieben in C/C++ Lizenz: GPL Seit 2003 24 Releases aktuell 3.3 340 Mitarbeiter 14 Targets (backends) Geschrieben in C++ Lizenz: University of Illinois/NCSA Open Source License BSD Style Der C++ Compiler H.Buchmann Clang/LLVM 3 / 18

Zwei wichtige Sponsoren/Konkurrenten was auch immer H.Buchmann Clang/LLVM 4 / 18

Zwei wichtige Sponsoren/Konkurrenten was auch immer GN U/ L bj O inu xk o XC? ac C /M de e tiv ec ern el S O X H.Buchmann Clang/LLVM 4 / 18

Zwei wichtige Sponsoren/Konkurrenten was auch immer GN U/ L bj O inu xk o XC? ac C /M de e tiv ec ern el S O X Clang/LLVM auch strategische Software? H.Buchmann Clang/LLVM 4 / 18

2012 ACM System Software Award LLVM/Clang Strategische Software?... Key factors in its success are the openness of its technology and the quality of its architecture and engineering as well as its clean, flexible design and easy-to-use programming interfaces... awards.acm.org/software_system Chris Lattner Vikram Adve Evan Cheng UIUC H.Buchmann Clang/LLVM 5 / 18

2012 ACM System Software Award LLVM/Clang Strategische Software?... Key factors in its success are the openness of its technology and the quality of its architecture and engineering as well as its clean, flexible design and easy-to-use programming interfaces... Andere Preisträger (Auswahl) 2011 Eclipse 2009 VMware Workstation for Linux 1.0 2003 Make 2002 Java 1983 UNIX awards.acm.org/software_system H.Buchmann Clang/LLVM 5 / 18

Clang/LLVM oder umgekehrt Aktuell The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them. Clang The name LLVM itself is not an acronym; it is the full name of the the project Teil einer ganzen Suite llvm.org Historisch The LLVM Compiler Infrastructure LLVM Low Level Virtual Machine University of Illinois at Urbana-Champaign H.Buchmann Clang/LLVM 6 / 18

Clang/LLVM oder umgekehrt Aktuell The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them. Clang The name LLVM itself is not an acronym; it is the full name of the the project Teil einer ganzen Suite llvm.org Historisch The LLVM Compiler Infrastructure LLVM Low Level Virtual Machine University of Illinois at Urbana-Champaign H.Buchmann Clang/LLVM 6 / 18

Clang/LLVM oder umgekehrt Aktuell The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them. Clang The name LLVM itself is not an acronym; it is the full name of the the project Teil einer ganzen Suite llvm.org Historisch The LLVM Compiler Infrastructure LLVM Low Level Virtual Machine University of Illinois at Urbana-Champaign H.Buchmann Clang/LLVM 6 / 18

Black Box H L L High Level programming Language frontend Compiler I L optimize IR Intermediate Representation universeller Assembler pro HLL ein frontend pro TASM ein backend I L backend #Komponenten = #HLL + #TASM + 1 T A S M Compiler Infrastruktur Target Assembler H.Buchmann Clang/LLVM 7 / 18

Die Komponenten Compiler Infrastruktur H L L frontend Compiler I R optimize I R backend IR Intermediate Representation universeller Assembler pro HLL ein frontend pro TASM ein backend #Komponenten = #HLL + #TASM + 1 T A S M H.Buchmann Clang/LLVM 7 / 18

Die Komponenten Compiler Infrastruktur H L L frontend Compiler I R nur ein optimize optimize I R backend IR Intermediate Representation universeller Assembler pro HLL ein frontend pro TASM ein backend #Komponenten = #HLL + #TASM + 1 T A S M H.Buchmann Clang/LLVM 7 / 18

Die Kommandozeile Clang/LLVM Compiler kompatibel zu GCC src dst Optionen clang++../src/hello-world.cc -o hello-world -O2 -std=c++11 g++ Fehlermeldungen: Clang../src/hello-world.cc:22:22: error: expected ';' after expression std::cout<<"world\n" ^ ; GCC../src/hello-world.cc: In destructor World:: World() :../src/hello-world.cc:23:1: error: expected ; before } token } ^ H.Buchmann Clang/LLVM 8 / 18

Die Kommandozeile Clang/LLVM Compiler kompatibel zu GCC src dst Optionen clang++../src/hello-world.cc -o hello-world -O2 -std=c++11 g++ Fehlermeldungen: Clang../src/hello-world.cc:22:22: error: expected ';' after expression std::cout<<"world\n" ^ ; GCC../src/hello-world.cc: In destructor World:: World() :../src/hello-world.cc:23:1: error: expected ; before } token } ^ H.Buchmann Clang/LLVM 8 / 18

Die Kommandozeile Clang/LLVM Compiler kompatibel zu GCC src dst Optionen clang++../src/hello-world.cc -o hello-world -O2 -std=c++11 g++ Fehlermeldungen: Clang../src/hello-world.cc:22:22: error: expected ';' after expression std::cout<<"world\n" ^ ; GCC../src/hello-world.cc: In destructor World:: World() :../src/hello-world.cc:23:1: error: expected ; before } token } ^ wird/ist besser in GCC-4.9 H.Buchmann Clang/LLVM 8 / 18

HLL // // d i v 1 0 // ( c ) H. Buchmann FHNW 2013 // unsigned d i v 1 0 ( unsigned x ) { r e t u r n x / 1 0 ; } HLL IR TASM Ein Beispiel: x/10 IR Intermediate Representation ; Function Attrs: nounwind readnone uwtable define i32 @ Z5div10j(i32 %x) #0 { %1 = udiv i32 %x, 10 ret i32 %1 x86 64 } ARM Z5div10j: movl %edi, %ecx movl $3435973837, %eax imulq %rcx, %rax shrq $35, %rax ret Z5div10j: ldr r2,.lcpi0 0 umull r3,r1, r0, r2 lsr r0,r1, #3 mov pc,lr.lcpi0 0:.long 3435973837 H.Buchmann Clang/LLVM 9 / 18

HLL // // d i v 1 0 // ( c ) H. Buchmann FHNW 2013 // unsigned d i v 1 0 ( unsigned x ) { r e t u r n x / 1 0 ; } HLL IR TASM Ein Beispiel: x/10 IR Intermediate Representation ; Function Attrs: nounwind readnone uwtable define i32 @ Z5div10j(i32 %x) #0 { %1 = udiv i32 %x, 10 ret i32 %1 x86 64 } ARM Z5div10j: movl %edi, %ecx movl $3435973837, %eax imulq %rcx, %rax shrq $35, %rax ret Z5div10j: ldr r2,.lcpi0 0 umull r3,r1, r0, r2 lsr r0,r1, #3 mov pc,lr.lcpi0 0:.long 3435973837 H.Buchmann Clang/LLVM 9 / 18

HLL // // d i v 1 0 // ( c ) H. Buchmann FHNW 2013 // unsigned d i v 1 0 ( unsigned x ) { r e t u r n x / 1 0 ; } HLL IR TASM Ein Beispiel: x/10 IR Intermediate Representation ; Function Attrs: nounwind readnone uwtable define i32 @ Z5div10j(i32 %x) #0 { %1 = udiv i32 %x, 10 ret i32 %1 x86 64 } ARM Z5div10j: movl %edi, %ecx movl $3435973837, %eax imulq %rcx, %rax shrq $35, %rax ret Z5div10j: ldr r2,.lcpi0 0 umull r3,r1, r0, r2 lsr r0,r1, #3 mov pc,lr.lcpi0 0:.long 3435973837 H.Buchmann Clang/LLVM 9 / 18

HLL // // d i v 1 0 // ( c ) H. Buchmann FHNW 2013 // unsigned d i v 1 0 ( unsigned x ) { r e t u r n x / 1 0 ; } HLL IR TASM Ein Beispiel: x/10 x 10 3435973837 2 x = 0.100000000005821x 35 IR Intermediate Representation ; Function Attrs: nounwind readnone uwtable define i32 @ Z5div10j(i32 %x) #0 { %1 = udiv i32 %x, 10 ret i32 %1 x86 64 } ARM Z5div10j: movl %edi, %ecx movl $3435973837, %eax imulq %rcx, %rax shrq $35, %rax ret Z5div10j: ldr r2,.lcpi0 0 umull r3,r1, r0, r2 lsr r0,r1, #3 mov pc,lr.lcpi0 0:.long 3435973837 H.Buchmann Clang/LLVM 9 / 18

Clang/LLVM Crosskompilation am Beispiel ARM src obj compile Optionen clang++../src/div10.cc -o div10.o -c -O3 -std=c++11 Target -target arm -integrated-as H.Buchmann Clang/LLVM 10 / 18

Clang/LLVM Crosskompilation am Beispiel ARM src obj compile Optionen clang++../src/div10.cc -o div10.o -c -O3 -std=c++11 braucht externen assembler nicht Target -target arm -integrated-as H.Buchmann Clang/LLVM 10 / 18

Clang/LLVM Crosskompilation am Beispiel ARM src Viele toolchains pro Architektur (target) eine toolchain z.b obj arm-none-linux-gnueabi-tool compile Optionen clang++../src/div10.cc -o div10.o -c -O3 -std=c++11 Target -target arm -integrated-as ein make H.Buchmann Clang/LLVM 10 / 18

H L L frontend LLVM Virtuelle Maschine abgesetztes backend Compiler VM I R optimize I R 1. erzeuge IR Code clang++../src/prime-number.cc -oprime-number.bc -c -O3 -std=c++11 -emit-llvm 2. starte virtuelle Maschine VM lli prime-number.bc H.Buchmann Clang/LLVM 11 / 18

H L L frontend LLVM Virtuelle Maschine abgesetztes backend Compiler VM I R optimize I R a la Java 1. erzeuge IR Code clang++../src/prime-number.cc -oprime-number.bc -c -O3 -std=c++11 -emit-llvm 2. starte virtuelle Maschine VM lli prime-number.bc H.Buchmann Clang/LLVM 11 / 18

H L L frontend LLVM Virtuelle Maschine abgesetztes backend Compiler VM I R optimize I R 1. erzeuge IR Code clang++../src/prime-number.cc -oprime-number.bc -c -O3 -std=c++11 -emit-llvm 2. starte virtuelle Maschine VM lli prime-number.bc H.Buchmann Clang/LLVM 11 / 18

Sekunden Clang GCC interpretiert kompiliert kompiliert Bemerkungen 2.19 2.19 1.13 A 1.59 1.68 1.70 B Bemerkungen A GCC optimiert die Instruktionen auto rem=v%pi; auto quot=v/pi; B Gemacht mit auto res=std::div(v,pi); mit res.rem und res.quot Ein kleiner benchmark prime-numbers.cc H.Buchmann Clang/LLVM 12 / 18

Sekunden Clang GCC interpretiert kompiliert kompiliert Bemerkungen 2.19 2.19 1.13 A 1.59 1.68 1.70 B Bemerkungen A GCC optimiert die Instruktionen auto rem=v%pi; auto quot=v/pi; B Gemacht mit auto res=std::div(v,pi); mit res.rem und res.quot Ein kleiner benchmark prime-numbers.cc H.Buchmann Clang/LLVM 12 / 18

Compiler Das Clang API für eigene Anwendungen C/C++ Objective-C clang I R optimize I R Clang API frontend Clang baut AST backend Eigene Anwendung API Sammlung von h Files H.Buchmann Clang/LLVM 13 / 18

Compiler Das Clang API für eigene Anwendungen C/C++ Objective-C C/C++ Objective-C clang frontend I R optimize clang A S T I R Clang API Abstract Syntax Tree backend frontend Clang baut AST backend Eigene Anwendung API Sammlung von h Files H.Buchmann Clang/LLVM 13 / 18

Compiler Das Clang API für eigene Anwendungen C/C++ Objective-C C/C++ Objective-C clang frontend I R optimize clang A S T I R Clang API Abstract Syntax Tree backend frontend Clang baut AST backend Eigene Anwendung API Sammlung von h Files H.Buchmann Clang/LLVM 13 / 18

Das Clang plugin API PrintFunctionNames.cc c UIUC Das API #i n c l u d e c l a n g / Frontend / F r o n t e n d P l u g i n R e g i s t r y. h #i n c l u d e c l a n g /AST/AST. h #i n c l u d e c l a n g /AST/ASTConsumer. h #i n c l u d e c l a n g / Frontend / C o m p i l e r I n s t a n c e. h #i n c l u d e l l v m / Support / r a w o s t r e a m. h Der Code 2 Klassen,71 Zeilen Aufruf clang++ -c\ -Xclang -load -Xclang PrintFunctionNames.so \ -Xclang -plugin -Xclang print-fns\ cc-file H.Buchmann Clang/LLVM 14 / 18

Das Clang plugin API PrintFunctionNames.cc c UIUC Das API #i n c l u d e c l a n g / Frontend / F r o n t e n d P l u g i n R e g i s t r y. h #i n c l u d e c l a n g /AST/AST. h #i n c l u d e c l a n g /AST/ASTConsumer. h #i n c l u d e c l a n g / Frontend / C o m p i l e r I n s t a n c e. h #i n c l u d e l l v m / Support / r a w o s t r e a m. h Der Code 2 Klassen,71 Zeilen Aufruf clang++ -c\ -Xclang -load -Xclang PrintFunctionNames.so \ -Xclang -plugin -Xclang print-fns\ cc-file H.Buchmann Clang/LLVM 14 / 18

Das Clang plugin API PrintFunctionNames.cc c UIUC Das API #i n c l u d e c l a n g / Frontend / F r o n t e n d P l u g i n R e g i s t r y. h #i n c l u d e c l a n g /AST/AST. h #i n c l u d e c l a n g /AST/ASTConsumer. h #i n c l u d e c l a n g / Frontend / C o m p i l e r I n s t a n c e. h #i n c l u d e l l v m / Support / r a w o s t r e a m. h Der Code 2 Klassen,71 Zeilen Aufruf clang++ -c\ -Xclang -load -Xclang PrintFunctionNames.so \ -Xclang -plugin -Xclang print-fns\ cc-file H.Buchmann Clang/LLVM 14 / 18

Das Clang plugin API PrintFunctionNames.cc c UIUC Das API #i n c l u d e c l a n g / Frontend / F r o n t e n d P l u g i n R e g i s t r y. h #i n c l u d e c l a n g /AST/AST. h #i n c l u d e c l a n g /AST/ASTConsumer. h #i n c l u d e c l a n g / Frontend / C o m p i l e r I n s t a n c e. h #i n c l u d e l l v m / Support / r a w o s t r e a m. h Der Code 2 Klassen,71 Zeilen Aufruf clang++ -c\ -Xclang -load -Xclang PrintFunctionNames.so \ -Xclang -plugin -Xclang print-fns\ cc-file gibt es bei GCC auch H.Buchmann Clang/LLVM 14 / 18

Das Clang standalone API ClangFormat.cc c UIUC Das API #i n c l u d e c l a n g / B a s i c / D i a g n o s t i c. h #i n c l u d e c l a n g / B a s i c / D i a g n o s t i c O p t i o n s. h #i n c l u d e c l a n g / B a s i c / F i l e M a n a g e r. h #i n c l u d e c l a n g / B a s i c / SourceManager. h #i n c l u d e c l a n g / Format / Format. h #i n c l u d e c l a n g / Lex / L e x e r. h #i n c l u d e c l a n g / R e w r i t e / Core / R e w r i t e r. h #i n c l u d e l l v m / Support / F i l e S y s t e m. h #i n c l u d e l l v m / Support / S i g n a l s. h Der Code Keine Klassen, 4 Funktionen incl main Aufruf ClangFormat cc-file 193 Zeilen H.Buchmann Clang/LLVM 15 / 18

Das Clang standalone API ClangFormat.cc c UIUC Das API #i n c l u d e c l a n g / B a s i c / D i a g n o s t i c. h #i n c l u d e c l a n g / B a s i c / D i a g n o s t i c O p t i o n s. h #i n c l u d e c l a n g / B a s i c / F i l e M a n a g e r. h #i n c l u d e c l a n g / B a s i c / SourceManager. h #i n c l u d e c l a n g / Format / Format. h #i n c l u d e c l a n g / Lex / L e x e r. h #i n c l u d e c l a n g / R e w r i t e / Core / R e w r i t e r. h #i n c l u d e l l v m / Support / F i l e S y s t e m. h #i n c l u d e l l v m / Support / S i g n a l s. h Der Code Keine Klassen, 4 Funktionen incl main Aufruf ClangFormat cc-file 193 Zeilen H.Buchmann Clang/LLVM 15 / 18

Das Clang standalone API ClangFormat.cc c UIUC Das API #i n c l u d e c l a n g / B a s i c / D i a g n o s t i c. h #i n c l u d e c l a n g / B a s i c / D i a g n o s t i c O p t i o n s. h #i n c l u d e c l a n g / B a s i c / F i l e M a n a g e r. h #i n c l u d e c l a n g / B a s i c / SourceManager. h #i n c l u d e c l a n g / Format / Format. h #i n c l u d e c l a n g / Lex / L e x e r. h #i n c l u d e c l a n g / R e w r i t e / Core / R e w r i t e r. h #i n c l u d e l l v m / Support / F i l e S y s t e m. h #i n c l u d e l l v m / Support / S i g n a l s. h Der Code Keine Klassen, 4 Funktionen incl main Aufruf ClangFormat cc-file 193 Zeilen H.Buchmann Clang/LLVM 15 / 18

GPL BSD Style Lizenzen Clang vs. GCC Compile: Tooling: GCC Clang eigener Code kompilieren eigene Tools schreiben Eigener Code muss nicht GPL sein eigene Arbeit muss GPL sein H.Buchmann Clang/LLVM 16 / 18

Vergleich mit GCC Compiler + c++11: beide Codequalität: GCC Unterschiede sind minim Fehlermeldungen: Clang GCC holt auf Toolchain: Clang GCC pro target eine toolchain Crosscompile: beide Clang hat weniger targets Tooling plugin: beide Lizenzen standalone: Clang nicht vorgesehen in GCC H.Buchmann Clang/LLVM 17 / 18

Informationen & Hilfen llvm.org der Clang Compiler gcc.gnu.org der GCC Compiler und natürlich www.fhnw.ch/technik/ime Das Institut für Mikroelektronik der FHNW Remark(s): Für den Code: hans.buchmann@fhnw.ch Es wurden nur open source tools auf GNU/Linux verwendet H.Buchmann Clang/LLVM 18 / 18

Informationen & Hilfen llvm.org der Clang Compiler gcc.gnu.org der GCC Compiler und natürlich www.fhnw.ch/technik/ime Das Institut für Mikroelektronik der FHNW Remark(s): Für den Code: hans.buchmann@fhnw.ch Es wurden nur open source tools auf GNU/Linux verwendet H.Buchmann Clang/LLVM 18 / 18

Literature https://www.ohloh.net/p http://www.gnu.org/software/gcc/releases.html http://gcc.gnu.org/onlinedocs/gcc/contributors.html http://llvm.org/releases/ H.Buchmann Clang/LLVM 18 / 18