[analyzer] Strip trailing whitespace characters from input.

More universal way of removing trailing whitespace characters then 'chomp' does. Chomp "removes any trailing string that corresponds to the current value of $/" (quote from perldoc). In my case an input ended with '\r\r\n', chomp left '\r' at the end of input and the script ended up with an error "Use of uninitialized value in concatenation (.) or string"

llvm-svn: 199892
This commit is contained in:
Anton Yartsev 2014-01-23 14:12:48 +00:00
parent 55c625f222
commit 0cb7c8abc1
1 changed files with 2 additions and 3 deletions

View File

@ -158,9 +158,8 @@ sub GetCCArgs {
close(FROM_CHILD);
die "could not find clang line\n" if (!defined $line);
# Strip the newline and initial whitspace
chomp $line;
$line =~ s/^\s+//;
# Strip leading and trailing whitespace characters.
$line =~ s/^\s+|\s+$//g;
my @items = quotewords('\s+', 0, $line);
my $cmd = shift @items;
die "cannot find 'clang' in 'clang' command\n" if (!($cmd =~ /clang/));