<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-family: Calibri, sans-serif; font-size: 15px;">
<div style="color: rgb(0, 0, 0);">Hi,</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">I’m trying to use a clang static analyzer plugin with xcodebuild, but it doesn’t seem to load my plugin. I also tried the example plugin MainCallChecker at clang/examples/analyzer-plugin/MainCallChecker.cpp but no joy here.
 However, the plugin worked fine with makefile and when I directly used clang.</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">Here’s my simple test program [1]. It builds fine with xcodebuild [2].</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">
<div>Now, load the example plugin SampleAnalyzerPlugin.dylib via the -load-plugin switch and build the same project with xcodebuild [3]. Notice the error "no analyzer checkers are associated with ‘example.MainCallChecker’”.  Is this a bug in xcodebuild or scan-build?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>JS</div>
<div><br>
</div>
</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">[1]</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div><font color="#7f7f7f">jamesstark@taiko /tmp $ cat hello/hello/main.cpp</font></div>
<div><font color="#7f7f7f">#include <stdio.h></font></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">int main(int argc, const char * argv[])</font></div>
<div><font color="#7f7f7f">{</font></div>
<div><font color="#7f7f7f">    printf("Hi");</font></div>
<div><font color="#7f7f7f">    return 0;</font></div>
<div><font color="#7f7f7f">}</font></div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">[2]</div>
<div><font color="#7f7f7f">jamesstark@taiko /tmp $ xcodebuild -project hello/hello.xcodeproj</font></div>
<div><font color="#7f7f7f">=== BUILD TARGET hello OF PROJECT hello WITH THE DEFAULT CONFIGURATION (Release) ===</font></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">Check dependencies</font></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">** BUILD SUCCEEDED **</font></div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);">[3]</div>
<div><font color="#7f7f7f">jamesstark@taiko /tmp/hello $ scan-build -load-plugin /Users/jamesstark/llvm-release/Release+Asserts/lib/SampleAnalyzerPlugin.dylib --use-analyzer /Users/jamesstark/llvm-release/Release+Asserts/bin/clang -enable-checker example.MainCallChecker
 xcodebuild -project hello.xcodeproj</font></div>
<div><font color="#7f7f7f">scan-build: Using '/Users/jamesstark/<b>llvm-3.4</b>-release/Release+Asserts/bin/clang' for static analysis</font></div>
<div><font color="#7f7f7f">Build settings from command line:</font></div>
<div><font color="#7f7f7f">    CLANG_ANALYZER_EXEC = /Users/jamesstark/llvm-3.4-release/Release+Asserts/bin/clang</font></div>
<div><b><font color="#7f7f7f">    CLANG_ANALYZER_OTHER_FLAGS = -analyzer-checker example.MainCallChecker</font></b></div>
<div><font color="#7f7f7f">    CLANG_ANALYZER_OUTPUT = plist-html</font></div>
<div><font color="#7f7f7f">    CLANG_ANALYZER_OUTPUT_DIR = /var/folders/j0/k921s0mn1njdbts14yns077c0000gn/T/scan-build-2014-06-27-175336-26848-1</font></div>
<div><font color="#7f7f7f">    RUN_CLANG_STATIC_ANALYZER = YES</font></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">=== ANALYZE TARGET hello OF PROJECT hello WITH THE DEFAULT CONFIGURATION (Release) ===</font></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">Check dependencies</font></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">AnalyzeShallow hello/main.cpp</font></div>
<div><font color="#7f7f7f">    cd /tmp/hello</font></div>
<div><font color="#7f7f7f">    export LANG=en_US.US-ASCII</font></div>
<div><font color="#7f7f7f">    /Users/jamesstark/llvm-3.4-release/Release+Asserts/bin/clang -x c++ -arch x86_64 -fmessage-length=150 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -std=gnu++11 -stdlib=libc++ -fmodules -Wno-trigraphs
 -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses
 -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion
 -Wenum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof
 -mmacosx-version-min=10.9 -g -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-conversion -D__clang_analyzer__ -Xclang -analyzer-output=plist-html -Xclang -analyzer-config -Xclang path-diagnostics-alternate=true -Xclang -analyzer-config -Xclang report-in-main-source-file=true
 -Xclang -analyzer-config -Xclang mode=shallow -Xclang -analyzer-checker -Xclang security.insecureAPI.UncheckedReturn -Xclang -analyzer-checker -Xclang security.insecureAPI.getpw -Xclang -analyzer-checker -Xclang security.insecureAPI.gets -Xclang -analyzer-checker
 -Xclang security.insecureAPI.mkstemp -Xclang -analyzer-checker -Xclang security.insecureAPI.mktemp -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.rand -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.strcpy -Xclang -analyzer-checker
 -Xclang security.insecureAPI.vfork <b style="background-color: rgb(255, 255, 0);">
-Xclang -analyzer-checker -Xclang example.MainCallChecker</b> -iquote /tmp/hello/build/hello.build/Release/hello.build/hello-generated-files.hmap -I/tmp/hello/build/hello.build/Release/hello.build/hello-own-target-headers.hmap -I/tmp/hello/build/hello.build/Release/hello.build/hello-all-target-headers.hmap
 -iquote /tmp/hello/build/hello.build/Release/hello.build/hello-project-headers.hmap -I/tmp/hello/build/Release/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/tmp/hello/build/hello.build/Release/hello.build/DerivedSources/x86_64
 -I/tmp/hello/build/hello.build/Release/hello.build/DerivedSources -F/tmp/hello/build/Release --analyze /tmp/hello/hello/main.cpp -o /var/folders/j0/k921s0mn1njdbts14yns077c0000gn/T/scan-build-2014-06-27-175336-26848-1/StaticAnalyzer/hello/hello/normal/x86_64/main.plist</font></div>
<div><b><font color="#7f7f7f" style="background-color: rgb(255, 255, 0);">error: no analyzer checkers are associated with 'example.MainCallChecker'</font></b></div>
<div><b><font color="#7f7f7f" style="background-color: rgb(255, 255, 0);">1 error generated.</font></b></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">** BUILD SUCCEEDED **</font></div>
<div><font color="#7f7f7f"><br>
</font></div>
<div><font color="#7f7f7f">scan-build: Removing directory '/var/folders/j0/k921s0mn1njdbts14yns077c0000gn/T/scan-build-2014-06-27-175336-26848-1' because it contains no reports.</font></div>
<div><font color="#7f7f7f">scan-build: No bugs found.</font></div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div><font color="#7f7f7f">jamesstark@taiko /tmp/hello $ xcodebuild -version</font></div>
<div><font color="#7f7f7f">Xcode 5.1.1</font></div>
<div><font color="#7f7f7f">Build version 5B1008</font></div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
<div style="color: rgb(0, 0, 0);"><br>
</div>
</body>
</html>