]> granicus.if.org Git - clang/commitdiff
[analyzer] Strip trailing whitespace characters from input.
authorAnton Yartsev <anton.yartsev@gmail.com>
Thu, 23 Jan 2014 14:12:48 +0000 (14:12 +0000)
committerAnton Yartsev <anton.yartsev@gmail.com>
Thu, 23 Jan 2014 14:12:48 +0000 (14:12 +0000)
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"

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

tools/scan-build/ccc-analyzer

index 220452f0d00f3e36b2248ad9582f87998665ce6c..1522af824d15d16a2e5a494e44356122f38ddcdd 100755 (executable)
@@ -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/));