[cfe-commits] r71504 - /cfe/trunk/utils/ccc-analyzer
Ted Kremenek
kremenek at apple.com
Mon May 11 16:29:52 PDT 2009
Author: kremenek
Date: Mon May 11 18:29:51 2009
New Revision: 71504
URL: http://llvm.org/viewvc/llvm-project?rev=71504&view=rev
Log:
Use Text::ParseWords to make 'clang -###' parsing more robust.
Modified:
cfe/trunk/utils/ccc-analyzer
Modified: cfe/trunk/utils/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/ccc-analyzer?rev=71504&r1=71503&r2=71504&view=diff
==============================================================================
--- cfe/trunk/utils/ccc-analyzer (original)
+++ cfe/trunk/utils/ccc-analyzer Mon May 11 18:29:51 2009
@@ -18,6 +18,7 @@
use File::Temp qw/ tempfile /;
use File::Path qw / mkpath /;
use File::Basename;
+use Text::ParseWords;
my $CC = $ENV{'CCC_CC'};
if (!defined $CC) { $CC = "gcc"; }
@@ -115,15 +116,11 @@
close(FROM_CHILD);
die "could not find clang-cc line\n" if (!defined $line);
- my @items = ($line =~ /(".*?"|\S+)/g);
+ # Strip the newline and initial whitspace
+ chomp $line;
+ $line =~ s/^\s+//;
- for (my $i = 0; $i < scalar(@items); ++$i) {
- my $x = $items[$i];
- $x =~ s/^"//;
- $x =~ s/"$//;
- $items[$i] = $x;
- }
-
+ my @items = quotewords('\s+', 0, $line);
my $cmd = shift @items;
die "cannot find 'clang-cc' in 'clang' command\n" if (!($cmd =~ /clang-cc/));
return \@items;
More information about the cfe-commits
mailing list