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.6k
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
610
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
3
900
5分でSharePlay入門
tokorom
3
1.4k
HomeKit 2020
tokorom
7
2.5k
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
KnowledgeBaseDocuments APIでベクトルインデックス管理を自動化する
iidaxs
1
270
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
170
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
490
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
180
非機能品質を作り込むための実践アーキテクチャ
knih
5
1.5k
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
260
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
540
UI State設計とテスト方針
rmakiyama
2
650
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
870
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
ブラックフライデーで購入したPixel9で、Gemini Nanoを動かしてみた
marchin1989
1
540
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
GraphQLとの向き合い方2022年版
quramy
44
13k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
What's in a price? How to price your products and services
michaelherold
243
12k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
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/