[cfe-dev] scan-build with -analyzer-ipa=dynamic options

Byoungyoung Lee blee at gatech.edu
Mon Sep 24 07:25:10 PDT 2012


I've changed scan-build script to control IPA options as follows, and
it works fine. It seems to me that scan-build was not *truly*
supproting interprocedural analysis?

===================================================================
--- scan-build  (revision 163967)
+++ scan-build  (working copy)
@@ -1431,6 +1431,11 @@
     push @AnalysesToRun, "-analyzer-disable-checker", shift @ARGV;
     next;
   }
+  if ($arg eq "-analyzer-ipa") {
+    shift @ARGV;
+    push @AnalysesToRun, "-analyzer-ipa", shift @ARGV;
+    next;
+  }
   if ($arg eq "-load-plugin") {
     shift @ARGV;
     push @PluginsToLoad, "-load", shift @ARGV;


Thanks,
Byoungyoung

On Mon, Sep 24, 2012 at 12:01 AM, Byoungyoung Lee <blee at gatech.edu> wrote:
> By spending some time with scan-build and ccc-analyzer, I found that
> the options provided to the analyzer are set by parsing the output
> from "clang -### ...". As far as I know, the default IPA option is
> dynamic-bifurcate, but clang shows -dynamic-ipa=inlining.
>
> -----------------------------------------------------------------------
> $ clang++ -### --analyze -x c++ testCode/ShapeTable.cpp
> clang version 3.2 (trunk 163967)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
>  "/usr/local/bin/clang" "-cc1" "-triple" "x86_64-unknown-linux-gnu"
> "-analyze" "-disable-free" "-main-file-name" "ShapeTable.cpp"
> "-analyzer-store=region" "-analyzer-opt-\
> analyze-nested-blocks" "-analyzer-eagerly-assume"
> "-analyzer-ipa=inlining" "-analyzer-checker=core"
> "-analyzer-checker=unix" "-analyzer-checker=deadcode"
> "-analyzer-check\
> er=security.insecureAPI.UncheckedReturn"
> "-analyzer-checker=security.insecureAPI.getpw"
> "-analyzer-checker=security.insecureAPI.gets"
> "-analyzer-checker=security.insecure\
> API.mktemp" "-analyzer-checker=security.insecureAPI.mkstemp"
> "-analyzer-checker=security.insecureAPI.vfork" "-analyzer-output"
> "plist" "-w" "-mrelocation-model" "static" \
> "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
> "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64"
> "-target-linker-version" "2.22" "-momit-leaf-frame-poi\
> nter" "-resource-dir" "/usr/local/bin/../lib/clang/3.2"
> "-fmodule-cache-path" "/var/tmp/clang-module-cache"
> "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.\
> ./../include/c++/4.6" "-internal-isystem"
> "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu"
> "-internal-isystem" "/usr/lib/gcc/x86_64-linux-\
> gnu/4.6/../../../../include/c++/4.6/backward" "-internal-isystem"
> "/usr/local/include" "-internal-isystem"
> "/usr/local/bin/../lib/clang/3.2/include" "-internal-externc-is\
> ystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem"
> "/include" "-internal-externc-isystem" "/usr/include"
> "-fdeprecated-macro" "-fdebug-compilation-dir" "/\
> home/super/llvm/llvm/tools/clang/examples/InputMixPointer"
> "-ferror-limit" "19" "-fmessage-length" "171" "-mstackrealign"
> "-fobjc-runtime=gcc" "-fcxx-exceptions" "-fexcep\
> tions" "-fdiagnostics-show-option" "-o" "ShapeTable.plist" "-x" "c++"
> "testCode/ShapeTable.cpp"
>
> Thanks,
> Byoungyoung
>
>
> On Sun, Sep 23, 2012 at 5:14 PM, Byoungyoung Lee <blee at gatech.edu> wrote:
>> Hello Clang,
>>
>> I'm trying to run scan-build with my own checker, but it seems like
>> scan-build does not support to control "-analyzer-ipa" options? I
>> haven't checked the details of scan-build scripts, but -analyzer-ipa
>> options are hardcoded somewhere and scan-build only uses
>> "-analyzer-ipa=inlining" options. Is this because IPA analysis is too
>> expensive to be used for scan-build, or simply it's not implemented
>> yet?
>>
>> Thanks,
>> Byoungyoung



More information about the cfe-dev mailing list