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
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
270
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
160
Password-less Journey - パスキーへの移行を見据えたユーザーの準備 @ AXIES 2024
ritou
3
1.4k
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
180
MLOps の現場から
asei
6
630
株式会社ログラス − エンジニア向け会社説明資料 / Loglass Comapany Deck for Engineer
loglass2019
3
31k
非機能品質を作り込むための実践アーキテクチャ
knih
2
630
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Making Projects Easy
brettharned
116
5.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Automating Front-end Workflow
addyosmani
1366
200k
Visualization
eitanlees
146
15k
Being A Developer After 40
akosma
87
590k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
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/