Another try: we preserve all quotes and backslashes as is by passing 'true' to 
quotewords() and only remove quotes from macro definitions and arguments 
without spaces.


http://reviews.llvm.org/D9357

Files:
  tools/scan-build/ccc-analyzer

Index: tools/scan-build/ccc-analyzer
===================================================================
--- tools/scan-build/ccc-analyzer
+++ tools/scan-build/ccc-analyzer
@@ -145,7 +145,7 @@
   print OUT "@$Args\n";
   close OUT;
   `uname -a >> $PPFile.info.txt 2>&1`;
-  `$Compiler -v >> $PPFile.info.txt 2>&1`;
+  `"$Compiler" -v >> $PPFile.info.txt 2>&1`;
   rename($ofile, "$PPFile.stderr.txt");
   return (basename $PPFile);
 }
@@ -179,7 +179,12 @@
   die "could not find clang line\n" if (!defined $line);
   # Strip leading and trailing whitespace characters.
   $line =~ s/^\s+|\s+$//g;
-  my @items = quotewords('\s+', 0, $line);
+  my @items = quotewords('\s+', 1, $line);
+  my $IsMacroDef = 0;
+  foreach (@items) {
+    $_ = substr($_, 1, -1) if (!/\s+/ || $IsMacroDef);
+    $IsMacroDef = $_ eq "-D";
+  }
   my $cmd = shift @items;
   die "cannot find 'clang' in 'clang' command\n" if (!($cmd =~ /clang/));
   return \@items;

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: tools/scan-build/ccc-analyzer
===================================================================
--- tools/scan-build/ccc-analyzer
+++ tools/scan-build/ccc-analyzer
@@ -145,7 +145,7 @@
   print OUT "@$Args\n";
   close OUT;
   `uname -a >> $PPFile.info.txt 2>&1`;
-  `$Compiler -v >> $PPFile.info.txt 2>&1`;
+  `"$Compiler" -v >> $PPFile.info.txt 2>&1`;
   rename($ofile, "$PPFile.stderr.txt");
   return (basename $PPFile);
 }
@@ -179,7 +179,12 @@
   die "could not find clang line\n" if (!defined $line);
   # Strip leading and trailing whitespace characters.
   $line =~ s/^\s+|\s+$//g;
-  my @items = quotewords('\s+', 0, $line);
+  my @items = quotewords('\s+', 1, $line);
+  my $IsMacroDef = 0;
+  foreach (@items) {
+    $_ = substr($_, 1, -1) if (!/\s+/ || $IsMacroDef);
+    $IsMacroDef = $_ eq "-D";
+  }
   my $cmd = shift @items;
   die "cannot find 'clang' in 'clang' command\n" if (!($cmd =~ /clang/));
   return \@items;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to