Author: ayartsev
Date: Thu Jan 23 08:12:48 2014
New Revision: 199892

URL: http://llvm.org/viewvc/llvm-project?rev=199892&view=rev
Log:
[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"

Modified:
    cfe/trunk/tools/scan-build/ccc-analyzer

Modified: cfe/trunk/tools/scan-build/ccc-analyzer
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/ccc-analyzer?rev=199892&r1=199891&r2=199892&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/ccc-analyzer (original)
+++ cfe/trunk/tools/scan-build/ccc-analyzer Thu Jan 23 08:12:48 2014
@@ -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/));


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to