[llvm-commits] [llvm] r65182 - /llvm/trunk/utils/lint/common_lint.py

Misha Brukman brukman+llvm at gmail.com
Fri Feb 20 14:28:45 PST 2009


Author: brukman
Date: Fri Feb 20 16:28:45 2009
New Revision: 65182

URL: http://llvm.org/viewvc/llvm-project?rev=65182&view=rev
Log:
Only strip the newline character at the end of the lines that we're considering
for length and for trailing whitespace; otherwise, the whitespace themselves
will also be removed.

Modified:
    llvm/trunk/utils/lint/common_lint.py

Modified: llvm/trunk/utils/lint/common_lint.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lint/common_lint.py?rev=65182&r1=65181&r2=65182&view=diff

==============================================================================
--- llvm/trunk/utils/lint/common_lint.py (original)
+++ llvm/trunk/utils/lint/common_lint.py Fri Feb 20 16:28:45 2009
@@ -15,7 +15,7 @@
   """
   line_num = 1
   for line in lines:
-    length = len(line.rstrip())
+    length = len(line.rstrip('\n'))
     if length > max_length:
       print '%s:%d:Line exceeds %d chars (%d)' % (filename, line_num,
                                                   max_length, length)
@@ -32,7 +32,7 @@
   trailing_whitespace_re = re.compile(r'\s+$')
   line_num = 1
   for line in lines:
-    if trailing_whitespace_re.match(line.rstrip()):
+    if trailing_whitespace_re.match(line.rstrip('\n')):
       print '%s:%d:Trailing whitespace' % (filename, line_num)
     line_num += 1
 





More information about the llvm-commits mailing list