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
650
SharePlayの歴史と進化 そしてvisionOSへ (iOSDC 2023)
tokorom
3
920
5分でSharePlay入門
tokorom
3
1.5k
HomeKit 2020
tokorom
7
2.5k
Advanced Segue 2019年のSegue事情
tokorom
9
5.9k
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
Visual StudioとかIDE関連小ネタ話
kosmosebi
1
370
comilioとCloudflare、そして未来へと向けて
oliver_diary
6
430
機械学習を「社会実装」するということ 2025年版 / Social Implementation of Machine Learning 2025 Version
moepy_stats
4
860
デジタルアイデンティティ人材育成推進ワーキンググループ 翻訳サブワーキンググループ 活動報告 / 20250114-OIDF-J-EduWG-TranslationSWG
oidfj
0
410
ドメイン駆動設計の実践により事業の成長スピードと保守性を両立するショッピングクーポン
lycorptech_jp
PRO
7
760
Docker Desktop で Docker を始めよう
zembutsu
PRO
0
140
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
340
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
あなたの知らないクラフトビールの世界
miura55
0
120
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
150
エンジニアリングマネージャー視点での、自律的なスケーリングを実現するFASTという選択肢 / RSGT2025
yoshikiiida
4
3.6k
信頼されるためにやったこと、 やらなかったこと。/What we did to be trusted, What we did not do.
bitkey
PRO
0
2.1k
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
350
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Music & Morning Musume
bryan
46
6.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
The Language of Interfaces
destraynor
155
24k
Embracing the Ebb and Flow
colly
84
4.5k
A better future with KSS
kneath
238
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Making the Leap to Tech Lead
cromwellryan
133
9k
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/