diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-05-11 23:29:51 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-05-11 23:29:51 +0000 |
commit | 1df35e310d3402879857dd78f6fa9aaeb94b35c4 (patch) | |
tree | 457649f97839f7588a9575193e675d98e5d703cd | |
parent | 31ed552f8f6cf69ac6bc93bc497815b0d9cac0a4 (diff) |
Use Text::ParseWords to make 'clang -###' parsing more robust.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71504 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-x | utils/ccc-analyzer | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer index 8e1f26ba7f..89c638d464 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -18,6 +18,7 @@ use Cwd qw/ getcwd abs_path /; 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 @@ sub GetCCArgs { 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; |