]> granicus.if.org Git - clang/commitdiff
[analyzer] scan-build: support spaces in compiler path and arguments.
authorAnton Yartsev <anton.yartsev@gmail.com>
Mon, 4 May 2015 13:37:36 +0000 (13:37 +0000)
committerAnton Yartsev <anton.yartsev@gmail.com>
Mon, 4 May 2015 13:37:36 +0000 (13:37 +0000)
This fixes errors that occur if a path to the default compiler has spaces or if an argument with spaces is given to compiler (e.g. via -I). (http://reviews.llvm.org/D9357)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236423 91177308-0d34-0410-b5e6-96231b3b80d8

tools/scan-build/ccc-analyzer

index 4549b29a806e8e0be844723c5f4e9c0020bf71c9..5ee4f626151bff4a221fa891cc17ef5bcdb56053 100755 (executable)
@@ -145,7 +145,7 @@ sub ProcessClangFailure {
   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,7 @@ sub GetCCArgs {
   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 $cmd = shift @items;
   die "cannot find 'clang' in 'clang' command\n" if (!($cmd =~ /clang/));
   return \@items;