The attached patch adds support for @files to ccc-analyzer (which is used
by scan-build). This feature is a commonly accepted compiler option that
clang, gcc, and cl.exe (microsoft's compiler) all already support. This
will allow scan-build to support it too (assuming that the perl version of
ccc-analyzer is used).

Sincerely,
Alexander Coffin
Index: tools/scan-build/libexec/ccc-analyzer
===================================================================
--- tools/scan-build/libexec/ccc-analyzer	(revision 337145)
+++ tools/scan-build/libexec/ccc-analyzer	(working copy)
@@ -680,6 +680,28 @@
     next;
   }
 
+  if ($Arg =~ /^@/) {
+    local $/ = undef;
+    my $filename = substr $Arg, 1;
+    if (open FILE, $filename) {
+      my $string = <FILE>;
+      close FILE;
+      my @args_tmp = quotewords('\s+', 0, $string);
+
+      my $j = $i + 1;
+      foreach (@args_tmp) {
+          if (defined $_) {
+            # Insert right after @file to be parsed next
+            # (do not append to @ARGV)
+            splice @ARGV, $j, 0, $_;
+            $j++;
+          }
+      }
+    }
+
+    next;
+  }
+
   if (!($Arg =~ /^-/)) {
     push @Files, $Arg;
     next;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to