[PATCH] scan-build: Add --triple option to scan-build
Honggyu Kim
hong.gyu.kim at lge.com
Wed Jun 10 03:29:14 PDT 2015
Hi krememek, zaks.anna, sylvestre.ledru,
Currently scan-build cannot pass any triple information to clang.
It makes analysis failure when the build script has target specific compiler flags.
This patch adds --triple option to support analysis for other targets.
--triple [target triple name]
--triple=[target triple name]
This provides target triple information to clang.
http://reviews.llvm.org/D10356
Files:
tools/scan-build/ccc-analyzer
tools/scan-build/scan-build
Index: tools/scan-build/ccc-analyzer
===================================================================
--- tools/scan-build/ccc-analyzer
+++ tools/scan-build/ccc-analyzer
@@ -41,6 +41,7 @@
my $DefaultCCompiler;
my $DefaultCXXCompiler;
my $IsCXX;
+my $Triple;
# If on OSX, use xcrun to determine the SDK root.
my $UseXCRUN = 0;
@@ -77,6 +78,9 @@
$IsCXX = 0
}
+$Triple = $ENV{'CLANG_TRIPLE'};
+#if (!defined $Triple || ! -x $Triple) { $Triple = ''; }
+
##===----------------------------------------------------------------------===##
# Cleanup.
##===----------------------------------------------------------------------===##
@@ -237,6 +241,12 @@
my @PrintArgs;
my $dir;
+ if (!defined $Triple || ! -x $Triple) {
+ else
+ push @CmdArgs, "-triple";
+ push @CmdArgs, $Triple;
+ }
+
if ($Verbose) {
$dir = getcwd();
print STDERR "\n[LOCATION]: $dir\n";
Index: tools/scan-build/scan-build
===================================================================
--- tools/scan-build/scan-build
+++ tools/scan-build/scan-build
@@ -1150,6 +1150,11 @@
This is the same as "-use-cc" but for C++ code.
+ --triple [target triple name]
+ --triple=[target triple name]
+
+ This provides target triple information to clang.
+
-v
Enable verbose output from scan-build. A second and third '-v' increases
@@ -1479,6 +1484,24 @@
next;
}
+ if ($arg =~ /^--triple(=(.+))?$/) {
+ shift @ARGV;
+ my $triple;
+
+ if (!defined $2 || $2 eq "") {
+ if (!@ARGV) {
+ DieDiag("'--triple' option requires a triple name.\n");
+ }
+ $triple = shift @ARGV;
+ }
+ else {
+ $triple = $2;
+ }
+
+ $ENV{"CLANG_TRIPLE"} = $triple;
+ next;
+ }
+
if ($arg eq "-v") {
shift @ARGV;
$Verbose++;
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10356.27432.patch
Type: text/x-patch
Size: 1788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150610/9e773591/attachment.bin>
More information about the cfe-commits
mailing list