SlideShare a Scribd company logo
Douglas Chen [陳鍵源] <dougpuob@gmail.com>
A trip about
how I contribute to LLVM
COSCUP 2021 Taiwan
2021/July/31
2
1. Motivation
CppNameLint and Clang-Tidy
2. Beginning of a trip
Phabricator, Arcanist, Build, Test, and their
flows
3. Tips in a trip
Get out of trouble
4. Trip moments
Happened during the code review
5. The last
Agenda
Agenda
1. Motivation
4
CppNameLint
Windows
Linux
macOS
https://github.com/dougpuob/cppnamelint
1. UpperCamel,
2. lowerCamel,
3. UPPER_SNAKE_CASE,
4. lower_snake_case,
5. szHungarianNotion
5
Implement into Clang-Tidy
Clang-Tidy
CppNameLint
readability-identifier-naming
1. Libtooling (Clang based library)
2. Plenty checks (abseil-*, boost-*, cert-*, google-*, llvm-*, modernize-*,
performance-*, readability-, …)
3. Auto fix
Agenda
2. Beginning of a trip
7
1. Phabricator (phab)
2. Arcanist (arc)
3. Build
4. Test
8
Phabricator https://reviews.llvm.org/
arc
web-based
system
cmd utility
(Arcanist)
9
Phabricator
LLVM Discussion Forums
(https://llvm.discourse.group/)
All recent commits
Chat Invite Link
(https://discord.gg/xS7Z362)
GitHub Repository
(https://github.com/llvm/llvm-project)
BuildBots
(https://lab.llvm.org/buildbot)
Review works you participate to
10
Phabricator (differential page)
1⃣
3⃣
2⃣
4⃣
5⃣
11
Phabricator flow (a life of a differential)
Create a
differential
and upload
to Phab
Make
a change
Discuss it
Request
changes
Ready
to land
Land it Close
LGTM
1⃣ 3⃣
2⃣
4⃣
5⃣
7⃣ 8⃣ 9⃣
6⃣
Approved
12
Arcanist (command line interface for Phabricator)
● arc patch (apply changes in a revision to the working copy)
● arc lint (check your code for syntax and style errors)
● arc diff (send your code to Differential for review)
● arc land (push Git and Mercurial changes)
● arc help (shows this help)
● ...
arc
Local Git repo
13
Arcanist flow
Remote
Git repo
Central repo
with Phab
Code review
on Phab
arc land
arc diff
arc patch
git add
git commit
arc lint
Unaccepted
arc
Accepted
Ready to land
1⃣
3⃣
2⃣
4⃣
5⃣
7⃣
LGTM
6⃣
14
Build (command with BuildKite)
cmake ../llvm 
-G Ninja 
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libc;llvm" 
-D CMAKE_BUILD_TYPE=Release 
-D LLVM_ENABLE_ASSERTIONS=ON 
-D LLVM_BUILD_EXAMPLES=ON 
-D LLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml" 
-D LLVM_ENABLE_LLD=ON 
-D CMAKE_CXX_FLAGS=-gmlt
https://buildkite.com/llvm-project/premerge-checks/builds/39326#578995ee-9588-4901-89eb-8deedf3caea0
15
Test
1. Unit Test (in llvm/unittests with Google Test)
2. Regression Test (in llvm/test with llvm-lit - LLVM Integrated Tester)
3. Whole programs (test-suite, https://github.com/llvm/llvm-test-suite.git)
● ninja check-clang
● ninja check-llvm
● ninja check-all
Three
categories
Run via
build system
16
Test (manual trigger unit test)
$ build-rel/tools/clang/tools/extra/unittests/clang-tidy/ClangTidyTests
Run it
Result
17
Test (manual trigger regression test)
$ llvm-lit readability-identifier-naming-hungarian-notation.cpp
Result
Run it
18
Test (buildbots & buildkite)
https://buildkite.com/llvm-project/premerge-checks/builds/39
326#578995ee-9588-4901-89eb-8deedf3caea0
https://lab.llvm.org/buildbot/#/waterfall
Agenda
3. Tips in the trip
# Based on main branch to create diff then send it for review
arc diff main --update D86671
# Based on the 99304d commit to create diff then send it for review
arc diff 99304d --update D86671
# Based on the 99304d commit to create diff but don’t send it out
arc diff 99304d --preview D86671
20
TIPS #1 Choose the right base
21
TIPS #2 Generate documents
-DLLVM_ENABLE_SPHINX=ON
● ninja docs-clang-html
● ninja docs-clang-tools-html
● ninja docs-llvm-html
● ninja docs-dsymutil-man
● ninja docs-clang-man
● ninja docs-clang-tools-man
● ninja docs-llvm-dwarfdump-man
● ninja docs-llvm-man
Sphinx is a tool that makes it easy to
create intelligent and beautiful
documentation, written by Georg Brandl
and licensed under the BSD license. It was
originally created for the Python
documentation, and it has excellent
facilities for the documentation of
software projects in a range of languages.
Of course, this site is also created from
reStructuredText sources using Sphinx!
CMake
option
Build via
build system
22
TIPS #3 You need an more powerful computer
Unit is mins
https:/
/dougpuob.github.io/posts/20210530-build-speed-comparison-btw-lxc-qemu-and-baremetal-by-llvm/
23
TIPS #4 Linker is a memory monster
Add -DLLVM_USE_LINKER=lld
debug build
CMake option
Agenda
4. Trip moments
25
Moment #1
int iVal = 0;
size_t nVal = 0;
uint8_t u8Val = 0;
uint16_t u16Val = 0;
uint32_t u32Val = 0;
BOOL bEnabled = TRUE;
ULONG ulVal = 0;
WORD wVal = 0;
DWORD dwVal = 0;
int *piVal = NULL;
char *szStr = “Str”;
char szText[] = “Text”;
Is there a standard for Hungarain notation ?
int iVal = 0;
int nVal = 0;
BOOL* bEnabled = TRUE;
BYTE* bValue = 0xA5;
char* szText = “Text”;
char* strText = “Text”;
Built-in
types
Microsoft
defined
Composite
types
❓
❓
❓
26
Moment #2 Original idea was changed, but better
27
Moment #3 Invalid identifier naming option
$ clang-tidy ./main.cpp
...
1 warning generated.
warning: invalid identifier naming option 'MacroDefinitionHungarianPrefix' [clang-tidy-config]
Checks: '-*,readability-identifier-naming'
CheckOptions:
- { key: readability-identifier-naming.MacroDefinitionHungarianPrefix, value: On }
- { key: readability-identifier-naming.AbstractClassHungarianPrefix , value: On }
- { key: readability-identifier-naming.ClassHungarianPrefix , value: On }
.clang-tidy
console output
28
Moment #4
[Hungarian.WordList]
"uint32_t" = "u32"
"int" = "i"
"unsigned int" = "ui"
"DWORD" = "dw"
"BOOL" = "b"
limited configuration
readability-identifier-naming.HungarianNotation.PrimitiveType.uint32_t , value: u32
readability-identifier-naming.HungarianNotation.PrimitiveType.int , value: i
readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-int , value: i
readability-identifier-naming.HungarianNotation.PrimitiveType.DWORD , value: dw
readability-identifier-naming.HungarianNotation.PrimitiveType.BOOL , value: b
cppnamelint.toml
.clang-tidy
29
Moment #5 How ‘--fix’ works
// readability-identifier-naming-hungarian-notation-cfgfile.cpp
int LocalVariableCase = 0;
warning: invalid case style for local variable 'LocalVariableCase' [readability-identifier-naming]
int LocalVariableCase = 0;
^~~~~~~~~~~~~~~~~
iLocalVariableCase
input source file
console output
clang-tidy source
30
Moment #6 How Regression Test works
FileCheck check result
matching pattern
input from stdin or argv
pattern
regression test source
Agenda
5. The last
32
If you was stuck ...
1. Read related documents on https://llvm.org/docs/ .
2. Search similar projects on GitHub.
3. Official community forum (https://llvm.discourse.group/)
4. Discuss with your reviewers.
33
Reference (hightly recommend)
● https://llvm.org/docs/CodeReview.html
● https://llvm.org/docs/CodingStandards.html
● https://llvm.org/docs/DeveloperPolicy.html
● https://llvm.org/docs/Phabricator.html
● How to Contribute to LLVM (Bieneman & K. Barton)
Agenda
END

More Related Content

What's hot

Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
Hiroshi Nakamura
 
LCU14 209- LLVM Linux
LCU14 209- LLVM LinuxLCU14 209- LLVM Linux
LCU14 209- LLVM Linux
Linaro
 
How to make a large C++-code base manageable
How to make a large C++-code base manageableHow to make a large C++-code base manageable
How to make a large C++-code base manageable
corehard_by
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
Bo-Yi Wu
 
NovaProva, a new generation unit test framework for C programs
NovaProva, a new generation unit test framework for C programsNovaProva, a new generation unit test framework for C programs
NovaProva, a new generation unit test framework for C programs
Greg Banks
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
Ontico
 
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CanSecWest
 
Cgc2
Cgc2Cgc2
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
Tzung-Bi Shih
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
Bo-Yi Wu
 
The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014
Jian-Hong Pan
 
Intel Nervana Graph とは?
Intel Nervana Graph とは?Intel Nervana Graph とは?
Intel Nervana Graph とは?
Mr. Vengineer
 
Java Hates Linux. Deal With It.
Java Hates Linux.  Deal With It.Java Hates Linux.  Deal With It.
Java Hates Linux. Deal With It.
Greg Banks
 
Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;
Tzung-Bi Shih
 
How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applications
hubx
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
Peter Hlavaty
 
Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...
Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...
Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...
confluent
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
Susan Potter
 
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDevMake Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Jian-Hong Pan
 
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Anne Nicolas
 

What's hot (20)

Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
 
LCU14 209- LLVM Linux
LCU14 209- LLVM LinuxLCU14 209- LLVM Linux
LCU14 209- LLVM Linux
 
How to make a large C++-code base manageable
How to make a large C++-code base manageableHow to make a large C++-code base manageable
How to make a large C++-code base manageable
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
 
NovaProva, a new generation unit test framework for C programs
NovaProva, a new generation unit test framework for C programsNovaProva, a new generation unit test framework for C programs
NovaProva, a new generation unit test framework for C programs
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
 
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
CSW2017 Henry li how to find the vulnerability to bypass the control flow gua...
 
Cgc2
Cgc2Cgc2
Cgc2
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
 
Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署Drone CI/CD 自動化測試及部署
Drone CI/CD 自動化測試及部署
 
The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014
 
Intel Nervana Graph とは?
Intel Nervana Graph とは?Intel Nervana Graph とは?
Intel Nervana Graph とは?
 
Java Hates Linux. Deal With It.
Java Hates Linux.  Deal With It.Java Hates Linux.  Deal With It.
Java Hates Linux. Deal With It.
 
Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;
Global Interpreter Lock: Episode III - cat &lt; /dev/zero > GIL;
 
How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applications
 
Power of linked list
Power of linked listPower of linked list
Power of linked list
 
Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...
Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...
Exactly Once Semantics Revisited (Jason Gustafson, Confluent) Kafka Summit NY...
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
 
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDevMake Your Own Developement Board @ 2014.4.21 JuluOSDev
Make Your Own Developement Board @ 2014.4.21 JuluOSDev
 
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
 

Similar to [COSCUP 2021] A trip about how I contribute to LLVM

Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
CocoaHeads France
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
Andrea Righi
 
Semi-Automatic Code Cleanup with Clang-Tidy
Semi-Automatic Code Cleanup with Clang-TidySemi-Automatic Code Cleanup with Clang-Tidy
Semi-Automatic Code Cleanup with Clang-Tidy
Markus Werle
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
Troy Miles
 
Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side
Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows SideNagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side
Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side
Nagios
 
Android antipatterns
Android antipatternsAndroid antipatterns
Android antipatterns
Bartosz Kosarzycki
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
Sylvain Wallez
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?
Andrey Karpov
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
Sylvain Wallez
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environmentsAdvanced debugging  techniques in different environments
Advanced debugging  techniques in different environments
Andrii Soldatenko
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
Sylvain Wallez
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]
Devon Bernard
 
C++ Core Guidelines
C++ Core GuidelinesC++ Core Guidelines
C++ Core Guidelines
Thomas Pollak
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
Finding target for hacking on internet is now easier
Finding target for hacking on internet is now easierFinding target for hacking on internet is now easier
Finding target for hacking on internet is now easier
David Thomas
 
Node.js debugging
Node.js debuggingNode.js debugging
Node.js debugging
Nicholas McClay
 
Valgrind
ValgrindValgrind
Valgrind
aidanshribman
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
Frits Van Der Holst
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
Hajime Morrita
 
Js tacktalk team dev js testing performance
Js tacktalk team dev js testing performanceJs tacktalk team dev js testing performance
Js tacktalk team dev js testing performance
Артем Захарченко
 

Similar to [COSCUP 2021] A trip about how I contribute to LLVM (20)

Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
Semi-Automatic Code Cleanup with Clang-Tidy
Semi-Automatic Code Cleanup with Clang-TidySemi-Automatic Code Cleanup with Clang-Tidy
Semi-Automatic Code Cleanup with Clang-Tidy
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
 
Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side
Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows SideNagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side
Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side
 
Android antipatterns
Android antipatternsAndroid antipatterns
Android antipatterns
 
Inside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUGInside the JVM - Follow the white rabbit! / Breizh JUG
Inside the JVM - Follow the white rabbit! / Breizh JUG
 
Static code analysis: what? how? why?
Static code analysis: what? how? why?Static code analysis: what? how? why?
Static code analysis: what? how? why?
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environmentsAdvanced debugging  techniques in different environments
Advanced debugging  techniques in different environments
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]
 
C++ Core Guidelines
C++ Core GuidelinesC++ Core Guidelines
C++ Core Guidelines
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
 
Finding target for hacking on internet is now easier
Finding target for hacking on internet is now easierFinding target for hacking on internet is now easier
Finding target for hacking on internet is now easier
 
Node.js debugging
Node.js debuggingNode.js debugging
Node.js debugging
 
Valgrind
ValgrindValgrind
Valgrind
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
 
A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
 
Js tacktalk team dev js testing performance
Js tacktalk team dev js testing performanceJs tacktalk team dev js testing performance
Js tacktalk team dev js testing performance
 

Recently uploaded

INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
anfaltahir1010
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Paul Brebner
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
seospiralmantra
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 

Recently uploaded (20)

INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLESINTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
INTRODUCTION TO AI CLASSICAL THEORY TARGETED EXAMPLES
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
Why Apache Kafka Clusters Are Like Galaxies (And Other Cosmic Kafka Quandarie...
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
DevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps ServicesDevOps Consulting Company | Hire DevOps Services
DevOps Consulting Company | Hire DevOps Services
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 

[COSCUP 2021] A trip about how I contribute to LLVM

  • 1. Douglas Chen [陳鍵源] <dougpuob@gmail.com> A trip about how I contribute to LLVM COSCUP 2021 Taiwan 2021/July/31
  • 2. 2 1. Motivation CppNameLint and Clang-Tidy 2. Beginning of a trip Phabricator, Arcanist, Build, Test, and their flows 3. Tips in a trip Get out of trouble 4. Trip moments Happened during the code review 5. The last Agenda
  • 5. 5 Implement into Clang-Tidy Clang-Tidy CppNameLint readability-identifier-naming 1. Libtooling (Clang based library) 2. Plenty checks (abseil-*, boost-*, cert-*, google-*, llvm-*, modernize-*, performance-*, readability-, …) 3. Auto fix
  • 7. 7 1. Phabricator (phab) 2. Arcanist (arc) 3. Build 4. Test
  • 9. 9 Phabricator LLVM Discussion Forums (https://llvm.discourse.group/) All recent commits Chat Invite Link (https://discord.gg/xS7Z362) GitHub Repository (https://github.com/llvm/llvm-project) BuildBots (https://lab.llvm.org/buildbot) Review works you participate to
  • 11. 11 Phabricator flow (a life of a differential) Create a differential and upload to Phab Make a change Discuss it Request changes Ready to land Land it Close LGTM 1⃣ 3⃣ 2⃣ 4⃣ 5⃣ 7⃣ 8⃣ 9⃣ 6⃣ Approved
  • 12. 12 Arcanist (command line interface for Phabricator) ● arc patch (apply changes in a revision to the working copy) ● arc lint (check your code for syntax and style errors) ● arc diff (send your code to Differential for review) ● arc land (push Git and Mercurial changes) ● arc help (shows this help) ● ... arc
  • 13. Local Git repo 13 Arcanist flow Remote Git repo Central repo with Phab Code review on Phab arc land arc diff arc patch git add git commit arc lint Unaccepted arc Accepted Ready to land 1⃣ 3⃣ 2⃣ 4⃣ 5⃣ 7⃣ LGTM 6⃣
  • 14. 14 Build (command with BuildKite) cmake ../llvm -G Ninja -D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libc;llvm" -D CMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_ASSERTIONS=ON -D LLVM_BUILD_EXAMPLES=ON -D LLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml" -D LLVM_ENABLE_LLD=ON -D CMAKE_CXX_FLAGS=-gmlt https://buildkite.com/llvm-project/premerge-checks/builds/39326#578995ee-9588-4901-89eb-8deedf3caea0
  • 15. 15 Test 1. Unit Test (in llvm/unittests with Google Test) 2. Regression Test (in llvm/test with llvm-lit - LLVM Integrated Tester) 3. Whole programs (test-suite, https://github.com/llvm/llvm-test-suite.git) ● ninja check-clang ● ninja check-llvm ● ninja check-all Three categories Run via build system
  • 16. 16 Test (manual trigger unit test) $ build-rel/tools/clang/tools/extra/unittests/clang-tidy/ClangTidyTests Run it Result
  • 17. 17 Test (manual trigger regression test) $ llvm-lit readability-identifier-naming-hungarian-notation.cpp Result Run it
  • 18. 18 Test (buildbots & buildkite) https://buildkite.com/llvm-project/premerge-checks/builds/39 326#578995ee-9588-4901-89eb-8deedf3caea0 https://lab.llvm.org/buildbot/#/waterfall
  • 19. Agenda 3. Tips in the trip
  • 20. # Based on main branch to create diff then send it for review arc diff main --update D86671 # Based on the 99304d commit to create diff then send it for review arc diff 99304d --update D86671 # Based on the 99304d commit to create diff but don’t send it out arc diff 99304d --preview D86671 20 TIPS #1 Choose the right base
  • 21. 21 TIPS #2 Generate documents -DLLVM_ENABLE_SPHINX=ON ● ninja docs-clang-html ● ninja docs-clang-tools-html ● ninja docs-llvm-html ● ninja docs-dsymutil-man ● ninja docs-clang-man ● ninja docs-clang-tools-man ● ninja docs-llvm-dwarfdump-man ● ninja docs-llvm-man Sphinx is a tool that makes it easy to create intelligent and beautiful documentation, written by Georg Brandl and licensed under the BSD license. It was originally created for the Python documentation, and it has excellent facilities for the documentation of software projects in a range of languages. Of course, this site is also created from reStructuredText sources using Sphinx! CMake option Build via build system
  • 22. 22 TIPS #3 You need an more powerful computer Unit is mins https:/ /dougpuob.github.io/posts/20210530-build-speed-comparison-btw-lxc-qemu-and-baremetal-by-llvm/
  • 23. 23 TIPS #4 Linker is a memory monster Add -DLLVM_USE_LINKER=lld debug build CMake option
  • 25. 25 Moment #1 int iVal = 0; size_t nVal = 0; uint8_t u8Val = 0; uint16_t u16Val = 0; uint32_t u32Val = 0; BOOL bEnabled = TRUE; ULONG ulVal = 0; WORD wVal = 0; DWORD dwVal = 0; int *piVal = NULL; char *szStr = “Str”; char szText[] = “Text”; Is there a standard for Hungarain notation ? int iVal = 0; int nVal = 0; BOOL* bEnabled = TRUE; BYTE* bValue = 0xA5; char* szText = “Text”; char* strText = “Text”; Built-in types Microsoft defined Composite types ❓ ❓ ❓
  • 26. 26 Moment #2 Original idea was changed, but better
  • 27. 27 Moment #3 Invalid identifier naming option $ clang-tidy ./main.cpp ... 1 warning generated. warning: invalid identifier naming option 'MacroDefinitionHungarianPrefix' [clang-tidy-config] Checks: '-*,readability-identifier-naming' CheckOptions: - { key: readability-identifier-naming.MacroDefinitionHungarianPrefix, value: On } - { key: readability-identifier-naming.AbstractClassHungarianPrefix , value: On } - { key: readability-identifier-naming.ClassHungarianPrefix , value: On } .clang-tidy console output
  • 28. 28 Moment #4 [Hungarian.WordList] "uint32_t" = "u32" "int" = "i" "unsigned int" = "ui" "DWORD" = "dw" "BOOL" = "b" limited configuration readability-identifier-naming.HungarianNotation.PrimitiveType.uint32_t , value: u32 readability-identifier-naming.HungarianNotation.PrimitiveType.int , value: i readability-identifier-naming.HungarianNotation.PrimitiveType.unsigned-int , value: i readability-identifier-naming.HungarianNotation.PrimitiveType.DWORD , value: dw readability-identifier-naming.HungarianNotation.PrimitiveType.BOOL , value: b cppnamelint.toml .clang-tidy
  • 29. 29 Moment #5 How ‘--fix’ works // readability-identifier-naming-hungarian-notation-cfgfile.cpp int LocalVariableCase = 0; warning: invalid case style for local variable 'LocalVariableCase' [readability-identifier-naming] int LocalVariableCase = 0; ^~~~~~~~~~~~~~~~~ iLocalVariableCase input source file console output clang-tidy source
  • 30. 30 Moment #6 How Regression Test works FileCheck check result matching pattern input from stdin or argv pattern regression test source
  • 32. 32 If you was stuck ... 1. Read related documents on https://llvm.org/docs/ . 2. Search similar projects on GitHub. 3. Official community forum (https://llvm.discourse.group/) 4. Discuss with your reviewers.
  • 33. 33 Reference (hightly recommend) ● https://llvm.org/docs/CodeReview.html ● https://llvm.org/docs/CodingStandards.html ● https://llvm.org/docs/DeveloperPolicy.html ● https://llvm.org/docs/Phabricator.html ● How to Contribute to LLVM (Bieneman & K. Barton)