[cfe-dev] Clang Static Analyzer: how to use it for C++ application?

Liang Qi cavendish.qi at gmail.com
Tue Apr 26 15:01:28 PDT 2011


Got some interesting things, at least like:

[LOCATION]: /Users/liangqi/build/llvm-cmake/lib/Support
#SHELL (cd '/Users/liangqi/build/llvm-cmake/lib/Support' &&
'/usr/local/bin/clang++' '-cc1' '-triple' 'x86_64-apple-darwin10.0.0'
'-analyze' '-disable-free' '-disable-llvm-verifier' '-main-file-name'
'Dwarf.cpp' '-analyzer-store=region'
'-analyzer-opt-analyze-nested-blocks' '-analyzer-checker=core'
'-analyzer-checker=unix' '-analyzer-checker=macosx'
'-analyzer-checker=DeadStores' '-analyzer-eagerly-assume'
'-analyzer-output' 'plist' '-w' '-pic-level' '1' '-mdisable-fp-elim'
'-masm-verbose' '-munwind-tables' '-target-cpu' 'core2'
'-target-linker-version' '123.2' '-resource-dir'
'/usr/local/Cellar/llvm/2.9/bin/../lib/clang/2.9' '-D' '_DEBUG' '-D'
'__STDC_LIMIT_MACROS' '-D' '__STDC_CONSTANT_MACROS' '-I'
'/Users/liangqi/build/llvm-cmake/lib/Support' '-I'
'/Users/liangqi/dev/svn/llvm/lib/Support' '-I'
'/Users/liangqi/build/llvm-cmake/include' '-I'
'/Users/liangqi/dev/svn/llvm/include' '-ferror-limit' '19'
'-fmessage-length' '0' '-stack-protector' '1' '-fblocks'
'-fcxx-exceptions' '-fexceptions' '-fdiagnostics-show-option'
'-analyzer-display-progress' '-analyzer-output=html' '-o'
'/tmp/scan-build-2011-04-26-1' '-x' 'c++'
'/Users/liangqi/dev/svn/llvm/lib/Support/Dwarf.cpp')
ANALYZE: /Users/liangqi/dev/svn/llvm/lib/Support/Dwarf.cpp TagString
ANALYZE: /Users/liangqi/dev/svn/llvm/lib/Support/Dwarf.cpp ChildrenString
ANALYZE: /Users/liangqi/dev/svn/llvm/lib/Support/Dwarf.cpp AttributeString

Will try will my dummy/test project then.

On 26 April 2011 23:03, Ted Kremenek <kremenek at apple.com> wrote:
> Example of running it on the LLVM codebase:
>
> $ mkdir llvm-cmake
> $ cd llvm-cmake
> $ scan-build cmake -G "Unix Makefiles" ~/llvm
> ...
> $ scan-build make
>
>
> On Apr 26, 2011, at 1:49 PM, Liang Qi wrote:
>> Could you give me a build log like that for your successful c++
>> project? Or what are the correct parameters which should be used for
>> c++ project? for scan-build or c++-analyzer or clang++?

Regards,
Liang

-- 
http://www.qiliang.net



More information about the cfe-dev mailing list