kazuhiro.yabe created this revision. Herald added subscribers: rengolin, aemerson.
Dear all, This patch adds the '-target' option to the clang option to invoke to check the syntax when scan-build is called with the --analyzer-target option. I'm using scan-build in cross compile project. (target: armv7-a) Even when cross compiling, scan-build invokes clang with -triple (HOST ARCH) to check syntax. Therefore, if my code has some errors, clang reports error in syntax checking: error: unknown target CPU 'armv7-a' This patch fixes that issue. Thanks. https://reviews.llvm.org/D32959 Files: tools/scan-build/libexec/ccc-analyzer Index: tools/scan-build/libexec/ccc-analyzer =================================================================== --- tools/scan-build/libexec/ccc-analyzer +++ tools/scan-build/libexec/ccc-analyzer @@ -224,6 +224,10 @@ else { $Cmd = $Clang; + if (defined $AnalyzerTarget) { + push @Args, "-target", $AnalyzerTarget; + } + # Create arguments for doing regular parsing. my $SyntaxArgs = GetCCArgs($HtmlDir, "-fsyntax-only", \@Args); @CmdArgsSansAnalyses = @$SyntaxArgs; @@ -248,10 +252,6 @@ push @Args, "-Xclang", "-analyzer-viz-egraph-ubigraph"; } - if (defined $AnalyzerTarget) { - push @Args, "-target", $AnalyzerTarget; - } - my $AnalysisArgs = GetCCArgs($HtmlDir, "--analyze", \@Args); @CmdArgs = @$AnalysisArgs; }
Index: tools/scan-build/libexec/ccc-analyzer =================================================================== --- tools/scan-build/libexec/ccc-analyzer +++ tools/scan-build/libexec/ccc-analyzer @@ -224,6 +224,10 @@ else { $Cmd = $Clang; + if (defined $AnalyzerTarget) { + push @Args, "-target", $AnalyzerTarget; + } + # Create arguments for doing regular parsing. my $SyntaxArgs = GetCCArgs($HtmlDir, "-fsyntax-only", \@Args); @CmdArgsSansAnalyses = @$SyntaxArgs; @@ -248,10 +252,6 @@ push @Args, "-Xclang", "-analyzer-viz-egraph-ubigraph"; } - if (defined $AnalyzerTarget) { - push @Args, "-target", $AnalyzerTarget; - } - my $AnalysisArgs = GetCCArgs($HtmlDir, "--analyze", \@Args); @CmdArgs = @$AnalysisArgs; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits