[PATCH] D10356: scan-build: Add --triple option to scan-build

Honggyu Kim hong.gyu.kim at lge.com
Thu Jul 30 08:00:45 PDT 2015


honggyu.kim updated this revision to Diff 31028.
honggyu.kim added a comment.

Hi Anna,

I have updated the patch with full diff based as your requested.
But I cannot find Anton Yartsev here in phabricator so I cannot add him as a reviewer.
Can you please add him if you can find him?
Thanks very much for your comment.

Honggyu


http://reviews.llvm.org/D10356

Files:
  tools/scan-build/ccc-analyzer
  tools/scan-build/scan-build

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
@@ -1462,6 +1467,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++;
Index: tools/scan-build/ccc-analyzer
===================================================================
--- tools/scan-build/ccc-analyzer
+++ tools/scan-build/ccc-analyzer
@@ -68,6 +68,7 @@
 my $DefaultCCompiler;
 my $DefaultCXXCompiler;
 my $IsCXX;
+my $Triple;
 
 # If on OSX, use xcrun to determine the SDK root.
 my $UseXCRUN = 0;
@@ -104,6 +105,8 @@
   $IsCXX = 0
 }
 
+$Triple = $ENV{'CLANG_TRIPLE'};
+
 ##===----------------------------------------------------------------------===##
 # Cleanup.
 ##===----------------------------------------------------------------------===##
@@ -245,6 +248,10 @@
       push @Args, "-Xclang", "-analyzer-viz-egraph-ubigraph";
     }
 
+    if (defined $Triple) {
+      push @Args, "-target", $Triple;
+    }
+
     my $AnalysisArgs = GetCCArgs($HtmlDir, "--analyze", \@Args);
     @CmdArgs = @$AnalysisArgs;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10356.31028.patch
Type: text/x-patch
Size: 1750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150730/2913921f/attachment.bin>


More information about the cfe-commits mailing list