[PATCH] D32959: Add -target option when clang is invoked to check syntax
Kazuhiro Yabe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 8 00:06:58 PDT 2017
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32959.98128.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170508/c10a7418/attachment-0001.bin>
More information about the cfe-commits
mailing list