Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
clangのtoolを直接叩いてiOSアプリ開発をパワーアップ!
Search
tokorom
March 12, 2014
Technology
5
3.5k
clangのtoolを直接叩いてiOSアプリ開発をパワーアップ!
clang-formatとかclang-checkをiOSアプリ開発(Objective-C)でも使ってみようという話。
tokorom
March 12, 2014
Tweet
Share
More Decks by tokorom
See All by tokorom
続・SharePlayの歴史と進化 iOS18とApple Vision Proにおける新展開
tokorom
3
560
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
2
880
5分でSharePlay入門
tokorom
2
1.4k
HomeKit 2020
tokorom
7
2.4k
Advanced Segue 2019年のSegue事情
tokorom
9
5.8k
tvOSアプリUIの勘所
tokorom
1
2k
カッコ悪くリアクティブじゃダメですか?
tokorom
7
12k
古き良きsendAction (in potatotips #26)
tokorom
1
3.6k
画面遷移と私(iOS)
tokorom
4
3.7k
Other Decks in Technology
See All in Technology
Lexical Analysis
shigashiyama
1
150
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
880
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
130
OTelCol_TailSampling_and_SpanMetrics
gumamon
1
220
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
『Firebase Dynamic Links終了に備える』 FlutterアプリでのAdjust導入とDeeplink最適化
techiro
0
140
Taming you application's environments
salaboy
0
200
The Role of Developer Relations in AI Product Success.
giftojabu1
0
140
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
組織成長を加速させるオンボーディングの取り組み
sudoakiy
2
220
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.7k
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
A Philosophy of Restraint
colly
203
16k
Music & Morning Musume
bryan
46
6.2k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
The Cult of Friendly URLs
andyhume
78
6k
Fireside Chat
paigeccino
34
3k
Six Lessons from altMBA
skipperchong
27
3.5k
A Tale of Four Properties
chriscoyier
156
23k
Become a Pro
speakerdeck
PRO
25
5k
Scaling GitHub
holman
458
140k
Transcript
clangͷtoolΛୟ͍ͯ iOSΞϓϦ։ൃΛύϫʔΞοϓʂ ॴ ༑ଠ @tokorom iOS App Programer These are
“not” confidential sessions—please diffuse by your blogging and twitter potatotips #5
clangͱʁ • γʔϥϯά͡Όͳͯ͘ Ϋϥϯ (ˈklæŋ) •ϓϩάϥϛϯάݴޠ CɺC++ɺObjective-Cɺ Objective-C++ ͚ͷίϯύΠϥϑϩϯτΤϯυ ྆ํͱWikipediaΑΓ
ࠓհ͢Δͷ • ίʔυϑΥʔϚολʔʢclang-formatʣ • γϯλοΫενΣοΫʢclang-checkͱ͔ʣ • ͕࣌ؒ͋Ε ιʔείʔυิʢclang -code- completion-atʣΓ͔͚ͨͬͨͲ·ͨࠓ
ίʔυϑΥʔϚολʔʢclang-format)
clang-format
Uncrustifyͱͷൺֱ clang-format Uncrustify Πϯετʔϧ × େม ˕ ؆୯ ઃఆ߲ ˚
ͬ͘͟Γ ◦ ࡉ͔͍ ߦࢦఆ ˕ Ͱ͖Δ × Ͱ͖ͳ͍ʢͨͿΜʣ ެࣜ ˕ clangͦͷ·· -
ΫοΫύουͰclang-formatΛ࠾༻ • ͲͪΒࡉ͔͘ઃఆͨ͠ͱ͜ΖͰ100%ࢥ͍௨Γ ʹͳΒͳ͍ʢͲΜ͙Γͷഎൺʣ • clangͷtoolͰ͋Δͱ͍͏҆৺ײ • ಛఆͷߦ͚ͩͷϑΥʔϚοτ͕Ͱ͖Δ
Πϯετʔϧ •http://blog.hardcodes.de/articles/63/building- clang-format-and-friends-on-osx-mountain-lion •ͱʹ͔͘makeʹ͕͔͔࣌ؒΓ·͢
Xcodeͳਓ • ClangFormat-Xcode ͱ͍͏plugin͕͑·͢ https://github.com/travisjeffery/ClangFormat-Xcode
Vimͳਓ • vim-clang-format ͱ͍͏plugin͕͑·͢ https://github.com/rhysd/vim-clang-format •prefixΩʔΛࣗ༝ʹઃఆͰ͖ΔͷͰVimͷඪ४ͷ ϑΥʔϚοτ༻Ωʔʮ=ʯͰϑΥʔϚοτՄೳ •ʮ==ʯͰݱࡏߦ͚ͩϑΥʔϚοτͱ͔ɺϏϡ δϡΞϧϞʔυͰબͨ͠ߦ͚ͩʮ=ʯͰϑΥʔ Ϛοτͱ͔
γϯλοΫενΣοΫ
clang-check $ clang-check hello.m -- ! hello.m:12:5: error: unknown type
name 'MSString'; did you mean 'NSString'? MSString *string1 = nil; ^~~~~~~~ NSString /System/Library/Frameworks/Foundation.framework/Headers/ NSXPCConnection.h:13:29: note: 'NSString' declared here @class NSMutableDictionary, NSString, NSOperationQueue, NSSet, …; ^ 1 error generated. Error while processing /Users/ytokoro/develop/objc/hello.m.
XcodeͷϓϩδΣΫτͷϑΝΠϧͷ߹… $ clang -x objective-c -arch i386 -fmessage-length=0 -fdiagnostics- show-note-include-stack
-fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-cache-path=/Users/ytokoro/Library/Developer/Xcode/ DerivedData/ModuleCache -Wno-trigraphs -fpascal-strings -O0 -Wno- missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage - Werror=objc-root-class -Wno-receiver-is-weak -Wno-arc-repeated-use-of- weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses - Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter - Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno- unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion - Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum- conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno- selector -Wno-strict-selector-match -Wundeclared-selector -Wno- deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/ Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator7.0.sdk -fexceptions -fasm-blocks -fstrict-aliasing - Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -fobjc-abi- version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=7.0 - iquote /Users/ytokoro/Library/Developer/Xcode/DerivedData/
XcodeͷϓϩδΣΫτͷϑΝΠϧͷ߹… •ݱ࣮తͳܗͰclang-checkʹ͢ΦϓγϣϯΛಋ ग़͢Δज़͕·ͩΘ͔͍ͬͯͳ͍ •clang-check͍͍ͨͷʹͩΕ͔ϔϧϓʂ
clang-check͕͏·͑͘ΔΑ͏ʹͳͬͨΒ •VimEmacsͰXcodeόϦͷγϯλοΫε νΣοΫ/੩తղੳ͕؆୯ʹͰ͖ΔΑ͏ʹͳΔ •ίʔυΛॻ͍͍ͯΔ࠷தʹඇಉظʹγϯλοΫ ενΣοΫͯ͠هड़ϛεΛഁઢͰ໌ࣔͱ͔ • Vimͳਓ vim-watchdogs ͱ͍͏plugin͔Βݺͼ ग़͢ͱ͍͍͔Μ͡ʹͳΓͦ͏
https://github.com/osyo-manga/vim-watchdogs
ࠓ xcodebuild Ͱ༻͍ͯ͠·͢
ݱࡏͷ΅͘ͷνΣοΫڥ •vim-watchdogs ܦ༝Ͱ xcodebuild Λఆظతʹୟ ͍ͯɺίϯύΠϧΤϥʔ͕͋ΕΤϥʔ༰Λ QuickFixͰදࣔ • .vimrc ͷઃఆ͜ͷ͋ͨΓ
https://github.com/tokorom/dotfiles/blob/ master/.vimrc#L592-L604
More Information Yuta ToKoRo! iOS App Programer! @tokorom! ! http://www.tokoro.me/