Upgrade to Pro — share decks privately, control downloads, hide ads and more …

clangのtoolを直接叩いてiOSアプリ開発をパワーアップ!

tokorom
March 12, 2014

 clangのtoolを直接叩いてiOSアプリ開発をパワーアップ!

clang-formatとかclang-checkをiOSアプリ開発(Objective-C)でも使ってみようという話。

tokorom

March 12, 2014
Tweet

More Decks by tokorom

Other Decks in Technology

Transcript

  1. clangͷtoolΛ௚઀ୟ͍ͯ iOSΞϓϦ։ൃΛύϫʔΞοϓʂ ॴ ༑ଠ @tokorom iOS App Programer These are

    “not” confidential sessions—please diffuse by your blogging and twitter potatotips #5
  2. Uncrustifyͱͷൺֱ clang-format Uncrustify Πϯετʔϧ × େม ˕ ௒؆୯ ઃఆ߲໨ ˚

    ͬ͘͟Γ ◦ ࡉ͔͍ ߦࢦఆ ˕ Ͱ͖Δ × Ͱ͖ͳ͍ʢͨͿΜʣ ެࣜ౓ ˕ clangͦͷ·· -
  3. 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.
  4. 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/