[cfe-commits] r58600 - /cfe/trunk/utils/scan-build

Ted Kremenek kremenek at apple.com
Sun Nov 2 23:44:16 PST 2008


Author: kremenek
Date: Mon Nov  3 01:44:16 2008
New Revision: 58600

URL: http://llvm.org/viewvc/llvm-project?rev=58600&view=rev
Log:
Simplify the functions HtmlEsape and ShellEscape.  We now properly print out the following command line in the HTML output: scan-build gcc -x c /dev/null -c -Dfoo='"string abc"'

Fixes <rdar://problem/6338651>

Modified:
    cfe/trunk/utils/scan-build

Modified: cfe/trunk/utils/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/scan-build?rev=58600&r1=58599&r2=58600&view=diff

==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Mon Nov  3 01:44:16 2008
@@ -932,9 +932,9 @@
   # copy argument to new variable so we don't clobber the original
   my $arg = shift || '';
   my $tmp = $arg;
-
-  $tmp =~ s/([\<\>\'\"])/sprintf("&#%02x;", chr($1))/ge;
-
+  $tmp =~ s/&/&/g;
+  $tmp =~ s/</</g;
+  $tmp =~ s/>/>/g;
   return $tmp;
 }
 
@@ -945,11 +945,8 @@
 sub ShellEscape {
   # copy argument to new variable so we don't clobber the original
   my $arg = shift || '';
-  my $tmp = $arg;
-
-  $tmp =~ s/([\!\;\\\'\"\`\<\>\|\s\(\)\[\]\?\#\$\^\&\*\=])/\\$1/g;
-
-  return $tmp;
+  if ($arg =~ /["\s]/) { return "'" . $arg . "'"; }
+  return $arg;
 }
 
 ##----------------------------------------------------------------------------##





More information about the cfe-commits mailing list