{"id":214275,"date":"2014-03-03T09:12:03","date_gmt":"2014-03-03T05:12:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=214275"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=214275","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f Clang \u0432 Xcode<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f Clang \u0438 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Xcode-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/li>\n<li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439<\/li>\n<li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a<\/li>\n<li>\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0432 Xcode<\/li>\n<li>\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u043f\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a<\/li>\n<\/ul>\n<h5>TL;DR<\/h5>\n<p>  \u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/AlexDenisov\/ToyClangPlugin\">\u0437\u0434\u0435\u0441\u044c<\/a><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h5>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 <a href=\"https:\/\/github.com\/railsware\/BloodMagic\">BloodMagic<\/a> \u044f \u0440\u0435\u0448\u0438\u043b \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u0438\u043c\u0435\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 BM. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043a\u0430\u043a <code>lazy<\/code> \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u043d\u043e \u0432 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0435 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043a\u0430\u043a @\u00addynamic, \u0438\u043b\u0438 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043a\u0430\u043a <code>lazy<\/code>, \u043d\u043e \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438. \u042f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443 \u0447\u0442\u043e \u043f\u0440\u0438\u0439\u0434\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 <a href=\"http:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%B1%D1%81%D1%82%D1%80%D0%B0%D0%BA%D1%82%D0%BD%D0%BE%D0%B5_%D1%81%D0%B8%D0%BD%D1%82%D0%B0%D0%BA%D1%81%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%BE%D0%B5_%D0%B4%D0%B5%D1%80%D0%B5%D0%B2%D0%BE\">AST<\/a>, \u0430 \u043f\u043e\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u0435\u043d \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440.<\/p>\n<p>  \u042f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0440\u0430\u0437\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b: <a href=\"http:\/\/ru.wikipedia.org\/wiki\/Flex_(%D0%B3%D0%B5%D0%BD%D0%B5%D1%80%D0%B0%D1%82%D0%BE%D1%80_%D0%BB%D0%B5%D0%BA%D1%81%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D1%85_%D0%B0%D0%BD%D0%B0%D0%BB%D0%B8%D0%B7%D0%B0%D1%82%D0%BE%D1%80%D0%BE%D0%B2)\">flex<\/a> + <a href=\"http:\/\/ru.wikipedia.org\/wiki\/GNU_bison\">bison<\/a>, <a href=\"http:\/\/clang.llvm.org\/doxygen\/group__CINDEX.html\">libclang<\/a>, \u043d\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Clang.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u044f \u0437\u0430\u0434\u0430\u043b\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0446\u0435\u043b\u044f\u043c\u0438:<\/p>\n<ul>\n<li>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Xcode \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/li>\n<li>\u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0432 Xcode \u0434\u043b\u044f \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/li>\n<li>\u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 (\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c Xcode)<\/li>\n<\/ul>\n<p>  \u0424\u0438\u0447\u0438 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430:<\/p>\n<ul>\n<li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0431\u0443\u043a\u0432\u044b \u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435<\/li>\n<li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435<\/li>\n<li>\u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0442\u044c \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0434\u043b\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/li>\n<\/ul>\n<p>  <\/p>\n<h5>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h5>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d llvm\/clang, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432<\/p>\n<pre><code class=\"bash\">cd \/opt sudo mkdir llvm sudo chown `whoami` llvm cd llvm export LLVM_HOME=`pwd`<\/code><\/pre>\n<p>  \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f clang \u043d\u0430 \u043c\u043e\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u2014 3.3.1, \u043f\u043e\u0442\u043e\u043c\u0443 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<pre><code class=\"bash\">git clone -b release_33 https:\/\/github.com\/llvm-mirror\/llvm.git llvm git clone -b release_33 https:\/\/github.com\/llvm-mirror\/clang.git llvm\/tools\/clang git clone -b release_33 https:\/\/github.com\/llvm-mirror\/clang-tools-extra.git llvm\/tools\/clang\/tools\/extra git clone -b release_33 https:\/\/github.com\/llvm-mirror\/compiler-rt.git llvm\/projects\/compiler-rt   mkdir llvm_build cd llvm_build cmake ..\/llvm -DCMAKE_BUILD_TYPE:STRING=Release make -j`sysctl -n hw.logicalcpu` <\/code><\/pre>\n<p>  <\/p>\n<h5>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/p>\n<pre><code class=\"bash\">cd $LLVM_HOME mkdir toy_clang_plugin; cd toy_clang_plugin <\/code><\/pre>\n<p>  \u041d\u0430\u0448 \u043f\u043b\u0430\u0433\u0438\u043d \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f Clang&#8217;\u0430 \u0438 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"bash\">ToyClangPlugin.exports CMakeLists.txt ToyClangPlugin.cpp <\/code><\/pre>\n<p>  \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ToyClangPlugin.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">\/\/ ToyClangPlugin.cpp #include &quot;clang\/Frontend\/FrontendPluginRegistry.h&quot; #include &quot;clang\/AST\/AST.h&quot; #include &quot;clang\/AST\/ASTConsumer.h&quot; #include &quot;clang\/Frontend\/CompilerInstance.h&quot;   using namespace clang;   namespace {     class ToyConsumer : public ASTConsumer     {     };          class ToyASTAction : public PluginASTAction     {     public:         virtual clang::ASTConsumer *CreateASTConsumer(CompilerInstance &amp;Compiler,                                                       llvm::StringRef InFile)         {             return new ToyConsumer;         }                  bool ParseArgs(const CompilerInstance &amp;CI, const                        std::vector&lt;std::string&gt;&amp; args) {             return true;         }     }; }   static clang::FrontendPluginRegistry::Add&lt;ToyASTAction&gt; X(&quot;ToyClangPlugin&quot;, &quot;Toy Clang Plugin&quot;); <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">CMakeLists.txt<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cmake\">cmake_minimum_required (VERSION 2.6) project (ToyClangPlugin)  set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}\/bin ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}\/lib ) set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}\/lib )  set( LLVM_HOME \/opt\/llvm ) set( LLVM_SRC_DIR ${LLVM_HOME}\/llvm ) set( CLANG_SRC_DIR ${LLVM_HOME}\/llvm\/tools\/clang ) set( LLVM_BUILD_DIR ${LLVM_HOME}\/llvm_build ) set( CLANG_BUILD_DIR ${LLVM_HOME}\/llvm_build\/tools\/clang)  add_definitions (-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS) add_definitions (-D_GNU_SOURCE -DHAVE_CLANG_CONFIG_H)  set (CMAKE_CXX_COMPILER &quot;${LLVM_BUILD_DIR}\/bin\/clang++&quot;) set (CMAKE_CC_COMPILER &quot;${LLVM_BUILD_DIR}\/bin\/clang&quot;)  set (CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS}   -fPIC   -fno-common   -Woverloaded-virtual   -Wcast-qual   -fno-strict-aliasing   -pedantic   -Wno-long-long   -Wall   -Wno-unused-parameter   -Wwrite-strings   -fno-exceptions    -fno-rtti&quot;)  set (CMAKE_MODULE_LINKER_FLAGS &quot;-Wl,-flat_namespace -Wl,-undefined -Wl,suppress&quot;)  set (LLVM_LIBS   LLVMJIT   LLVMX86CodeGen   LLVMX86AsmParser   LLVMX86Disassembler   LLVMExecutionEngine   LLVMAsmPrinter   LLVMSelectionDAG   LLVMX86AsmPrinter   LLVMX86Info   LLVMMCParser   LLVMCodeGen   LLVMX86Utils   LLVMScalarOpts   LLVMInstCombine   LLVMTransformUtils   LLVMipa   LLVMAnalysis   LLVMTarget   LLVMCore   LLVMMC   LLVMSupport   LLVMBitReader   LLVMOption )  macro(add_clang_plugin name)   set (srcs ${ARGN})    include_directories( &quot;${LLVM_SRC_DIR}\/include&quot;     &quot;${CLANG_SRC_DIR}\/include&quot;     &quot;${LLVM_BUILD_DIR}\/include&quot;     &quot;${CLANG_BUILD_DIR}\/include&quot; )   link_directories( &quot;${LLVM_BUILD_DIR}\/lib&quot; )    add_library( ${name} SHARED ${srcs} )      if (SYMBOL_FILE)     set_target_properties( ${name} PROPERTIES LINK_FlAGS       &quot;-exported_symbols_list ${SYMBOL_FILE}&quot;)   endif()    foreach (clang_lib ${CLANG_LIBS})     target_link_libraries( ${name} ${clang_lib} )     endforeach()      foreach (llvm_lib ${LLVM_LIBS})     target_link_libraries( ${name} ${llvm_lib} )   endforeach()      foreach (user_lib ${USER_LIBS})     target_link_libraries( ${name} ${user_lib} )   endforeach()  endmacro(add_clang_plugin)  set(SYMBOL_FILE ToyClangPlugin.exports)  set (CLANG_LIBS   clang   clangFrontend   clangAST   clangAnalysis   clangBasic   clangCodeGen   clangDriver   clangFrontendTool   clangLex   clangParse   clangSema   clangEdit   clangSerialization   clangStaticAnalyzerCheckers   clangStaticAnalyzerCore   clangStaticAnalyzerFrontend )  set (USER_LIBS   pthread   curses )  add_clang_plugin(ToyClangPlugin    ToyClangPlugin.cpp )  set_target_properties(ToyClangPlugin PROPERTIES   LINKER_LANGUAGE CXX   PREFIX &quot;&quot;) <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ToyClangPlugin.exports<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">__ZN4llvm8Registry* <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Xcode-\u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 `CMakeLists.txt`<\/p>\n<pre><code class=\"bash\">mkdir build; cd build cmake -G Xcode .. open ToyClangPlugin.xcodeproj<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 &#8216;ALL_BUILD&#8217;, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c: `lib\/Debug\/ToyCLangPlugin.dylib`.<\/p>\n<h5>RecursiveASTVisitor<\/h5>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c AST \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <a href=\"http:\/\/clang.llvm.org\/doxygen\/classclang_1_1RecursiveASTVisitor.html\">RecursiveASTVisitor<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0434\u0435\u0440\u0435\u0432\u0443. \u0412\u0441\u0435 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e \u043e\u0442\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.<br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0432\u0441\u0435 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0432\u0448\u0438\u0435\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u044b:<\/p>\n<pre><code class=\"cpp\">class ToyClassVisitor : public RecursiveASTVisitor&lt;ToyClassVisitor&gt; { public:     bool VisitObjCInterfaceDecl(ObjCInterfaceDecl *declaration)     {         printf(&quot;ObjClass: %s\\n&quot;, declaration-&gt;getNameAsString().c_str());         return true;     } };  class ToyConsumer : public ASTConsumer { public:     void HandleTranslationUnit(ASTContext &amp;context) {         visitor.TraverseDecl(context.getTranslationUnitDecl());     } private:     ToyClassVisitor visitor; }; <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/p>\n<pre><code class=\"objectivec\">#import &lt;Foundation\/Foundation.h&gt;  @interface ToyObject : NSObject  @end  @implementation ToyObject  @end <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/p>\n<pre><code class=\"bash\">\/opt\/llvm\/toy_clang_plugin\/build $ $LLVM_HOME\/llvm_build\/bin\/clang ..\/test.m \\   -Xclang -load \\   -Xclang lib\/Debug\/ToyClangPlugin.dylib \\   -Xclang -plugin \\   -Xclang ToyClangPlugin <\/code><\/pre>\n<p>  \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<h5>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439<\/h5>\n<p>  \u0415\u0441\u043b\u0438 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0431\u0443\u043a\u0432\u044b \u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435, \u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435.<br \/>  \u0414\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/p>\n<pre><code class=\"cpp\">class ToyClassVisitor : public RecursiveASTVisitor&lt;ToyClassVisitor&gt; { private:     ASTContext *context; public:     void setContext(ASTContext &amp;context)     {         this-&gt;context = &amp;context;     } \/\/ ... };  \/\/ ... void HandleTranslationUnit(ASTContext &amp;context) {     visitor.setContext(context);     visitor.TraverseDecl(context.getTranslationUnitDecl()); } \/\/ ... <\/code><\/pre>\n<p>  \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"cpp\">bool VisitObjCInterfaceDecl(ObjCInterfaceDecl *declaration) {     checkForLowercasedName(declaration);     return true; } \/\/  ... void checkForLowercasedName(ObjCInterfaceDecl *declaration) {     StringRef name = declaration-&gt;getName();     char c = name[0];     if (isLowercase(c)) {         DiagnosticsEngine &amp;diagEngine = context-&gt;getDiagnostics();         unsigned diagID = diagEngine.getCustomDiagID(DiagnosticsEngine::Warning, &quot;Class name should not start with lowercase letter&quot;);         SourceLocation location = declaration-&gt;getLocation();         diagEngine.Report(location, diagID);     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441 \u00ab\u043f\u043b\u043e\u0445\u0438\u043c\u00bb \u0438\u043c\u0435\u043d\u0435\u043c<\/p>\n<pre><code class=\"objectivec\">@interface bad_ToyObject : NSObject  @end  @implementation bad_ToyObject  @end <\/code><\/pre>\n<p>  \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/p>\n<pre><code class=\"bash\">\/opt\/llvm\/toy_clang_plugin\/build $ $LLVM_HOME\/llvm_build\/bin\/clang ..\/test.m \\   -Xclang -load \\   -Xclang lib\/Debug\/ToyClangPlugin.dylib \\   -Xclang -plugin \\   -Xclang ToyClangPlugin  ..\/test.m:11:12: warning: Class name should not start with lowercase letter @interface bad_ToyObject : NSObject            ^ 1 warning generated. <\/code><\/pre>\n<p>  <\/p>\n<h5>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a<\/h5>\n<p>  \u0415\u0441\u043b\u0438 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435 (&#8216;_&#8217;), \u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<pre><code class=\"cpp\">void checkForUnderscoreInName(ObjCInterfaceDecl *declaration) {     size_t underscorePos = declaration-&gt;getName().find('_');     if (underscorePos != StringRef::npos) {         DiagnosticsEngine &amp;diagEngine = context-&gt;getDiagnostics();         unsigned diagID = diagEngine.getCustomDiagID(DiagnosticsEngine::Error, &quot;Class name with `_` forbidden&quot;);         SourceLocation location = declaration-&gt;getLocation().getLocWithOffset(underscorePos);         diagEngine.Report(location, diagID);     } }  bool VisitObjCInterfaceDecl(ObjCInterfaceDecl *declaration) {     \/\/ disable this check temporary     \/\/ checkForLowercasedName(declaration);     checkForUnderscoreInName(declaration);     return true; } <\/code><\/pre>\n<p>  \u0412\u044b\u0432\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/p>\n<pre><code class=\"bash\">\/opt\/llvm\/toy_clang_plugin\/build $ $LLVM_HOME\/llvm_build\/bin\/clang ..\/test.m \\   -Xclang -load \\   -Xclang lib\/Debug\/ToyClangPlugin.dylib \\   -Xclang -plugin \\   -Xclang ToyClangPlugin  ..\/test.m:11:15: error: Class name with `_` forbidden @interface bad_ToyObject : NSObject               ^ 1 error generated. <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u043a\u043e\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u0435\u0440\u0432\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0438 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435<\/p>\n<pre><code class=\"bash\">\/opt\/llvm\/toy_clang_plugin\/build $ $LLVM_HOME\/llvm_build\/bin\/clang ..\/test.m \\   -Xclang -load \\   -Xclang lib\/Debug\/ToyClangPlugin.dylib \\   -Xclang -plugin \\   -Xclang ToyClangPlugin  ..\/test.m:11:12: warning: Class name should not start with lowercase letter @interface bad_ToyObject : NSObject            ^ ..\/test.m:11:15: error: Class name with `_` forbidden @interface bad_ToyObject : NSObject               ^ 1 warning and 1 error generated. <\/code><\/pre>\n<p>  <\/p>\n<h5>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Xcode<\/h5>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 (\u043f\u043e\u0434 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u044f \u043f\u043e\u043d\u0438\u043c\u0430\u044e clang \u0438\u0437 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 Xcode) clang \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u043b\u0430\u0433\u0438\u043d\u044b, \u043f\u043e\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0445\u0430\u0447\u0438\u0442\u044c Xcode, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c<\/p>\n<p>  \u0420\u0430\u0441\u043f\u0430\u043a\u0443\u0439\u0442\u0435 <a href=\"https:\/\/github.com\/AlexDenisov\/ToyClangPlugin\/releases\/download\/0.0.1\/XcodeHacking.zip\">\u044d\u0442\u043e\u0442<\/a> \u0430\u0440\u0445\u0438\u0432 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">sudo mv HackedClang.xcplugin `xcode-select -print-path`\/..\/PlugIns\/Xcode3Core.ideplugin\/Contents\/SharedSupport\/Developer\/Library\/Xcode\/Plug-ins sudo mv HackedBuildSystem.xcspec `xcode-select -print-path`\/Platforms\/iPhoneSimulator.platform\/Developer\/Library\/Xcode\/Specifications <\/code><\/pre>\n<p>  \u042d\u0442\u0438 \u0445\u0430\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u044f\u0442 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432 Xcode \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0434\u043b\u044f OSX \u0438 iPhoneSimulator.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 Xcode \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u043e\u0432\u044b\u0439 clang \u0432 \u0441\u043f\u0438\u0441\u043a\u0435<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/74b\/9d2\/609\/74b9d26095094bfaa9ba680d2618b2a8.png\"\/><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043d\u0430\u0448 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 clang \u0432 &#8216;Build settings&#8217;.<br \/>  \u0427\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 &#8216;Other C Flags&#8217;<\/p>\n<pre><code class=\"bash\">-Xclang -load -Xclang \/opt\/llvm\/toy_clang_plugin\/build\/lib\/Debug\/ToyClangPlugin.dylib -Xclang -add-plugin -Xclang ToyClangPlugin <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7d7\/bb6\/e4a\/7d7bb6e4aea4b639bd6ce9b9cdf21a12.png\"\/><\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c `-add-plugin`, \u043f\u043e\u0442\u043e\u043c\u0443 \u043a\u0430\u043a \u0445\u043e\u0442\u0438\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0448 `ASTAction`, \u0430 \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439.<br \/>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/451\/73b\/f7e\/45173bf7eec5d0a9a8682990118062de.png\" alt=\"disable_modules\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430\u0448 `test.m` \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c\u0438 \u043f\u043e\u0434 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/2f8\/fd3\/748\/2f8fd374817eb321ff2a37ca6238e618.png\" alt=\"error_warning\"\/><\/p>\n<h5>\u0418\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438<\/h5>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0434\u043b\u044f \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439<\/p>\n<pre><code class=\"cpp\">void checkForLowercasedName(ObjCInterfaceDecl *declaration) {     StringRef name = declaration-&gt;getName();     char c = name[0];     if (isLowercase(c)) {         std::string tempName = name;         tempName[0] = toUppercase(c);         StringRef replacement(tempName);                  SourceLocation nameStart = declaration-&gt;getLocation();         SourceLocation nameEnd = nameStart.getLocWithOffset(name.size());                  FixItHint fixItHint = FixItHint::CreateReplacement(SourceRange(nameStart, nameEnd), replacement);                  DiagnosticsEngine &amp;diagEngine = context-&gt;getDiagnostics();         unsigned diagID = diagEngine.getCustomDiagID(DiagnosticsEngine::Warning, &quot;Class name should not start with lowercase letter&quot;);         SourceLocation location = declaration-&gt;getLocation();         diagEngine.Report(location, diagID).AddFixItHint(fixItHint);     } }  void checkForUnderscoreInName(ObjCInterfaceDecl *declaration) {     StringRef name = declaration-&gt;getName();     size_t underscorePos = name.find('_');     if (underscorePos != StringRef::npos) {         std::string tempName = name;         std::string::iterator end_pos = std::remove(tempName.begin(), tempName.end(), '_');         tempName.erase(end_pos, tempName.end());         StringRef replacement(tempName);                  SourceLocation nameStart = declaration-&gt;getLocation();         SourceLocation nameEnd = nameStart.getLocWithOffset(name.size());                  FixItHint fixItHint = FixItHint::CreateReplacement(SourceRange(nameStart, nameEnd), replacement);                  DiagnosticsEngine &amp;diagEngine = context-&gt;getDiagnostics();         unsigned diagID = diagEngine.getCustomDiagID(DiagnosticsEngine::Error, &quot;Class name with `_` forbidden&quot;);         SourceLocation location = declaration-&gt;getLocation().getLocWithOffset(underscorePos);         diagEngine.Report(location, diagID).AddFixItHint(fixItHint);     } } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0441\u043e\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u043b\u0430\u0433\u0438\u043d \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0441\u0431\u043e\u0440\u043a\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b13\/45b\/957\/b1345b9577328433c1939eaf8dda9ffe.png\" alt=\"warning_fixit_hint\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0c\/44b\/79e\/b0c44b79e2738416c60771db7f0831c7.png\" alt=\"error_fixit_hint\"\/><\/p>\n<h5>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h5>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f clang \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0437\u0430\u043d\u044f\u0442\u0438\u0435, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0433\u0440\u044f\u0437\u043d\u044b\u0445 \u0445\u0430\u043a\u043e\u0432 \u0441 Xcode, \u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0439 clang, \u043f\u043e\u0442\u043e\u043c\u0443 \u044f \u0431\u044b \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 production. Apple \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0430\u0442\u0447\u0435\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e clang&#8217;\u0430, \u0438 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0437\u043d\u0430\u0442\u044c \u0432 \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e Clang-\u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Xcode \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0435\u043c\u0430\u043b\u043e \u0443\u0441\u0438\u043b\u0438\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u043c, \u0447\u0442\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043e\u0441\u043e\u0431\u043e \u044e\u0437\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c.<br \/>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u2014 \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0439\u0441\u044f API.<\/p>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u043d\u0430 \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043d\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0439\u0442\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043b\u044e\u0434\u0435\u0439 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0442\u0430\u043a\u0438\u0445 \u0442\u044f\u0436\u0435\u043b\u044b\u0445 \u0448\u0442\u0443\u043a.<\/p>\n<p>  \u0415\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 <a href=\"https:\/\/twitter.com\/1101_debian\">twitter<\/a>, <a href=\"https:\/\/github.com\/AlexDenisov\/ToyClangPlugin\/issues\/new\">GitHub<\/a> \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0437\u0434\u0435\u0441\u044c.<\/p>\n<p>  Happy hacking!   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/214275\/\"> http:\/\/habrahabr.ru\/post\/214275\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f Clang \u0438 \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Xcode-\u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u0430<\/li>\n<li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439<\/li>\n<li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u043a<\/li>\n<li>\u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0432 Xcode<\/li>\n<li>\u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u043f\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a<\/li>\n<\/ul>\n<h5>TL;DR<\/h5>\n<p>  \u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/AlexDenisov\/ToyClangPlugin\">\u0437\u0434\u0435\u0441\u044c<\/a>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-214275","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=214275"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/214275\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}