summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lint/common_lint.py
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2009-02-20 22:28:45 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2009-02-20 22:28:45 +0000
commitf2e5bd8d2226ce30de60b8d4c9fd460dee4c41fc (patch)
treef8c0d65b2f3ad36b84f905fdedf0f0ed7293495b /llvm/utils/lint/common_lint.py
parent42afb619c6f374fa770c0b2a09e21ee819e868eb (diff)
downloadbcm5719-llvm-f2e5bd8d2226ce30de60b8d4c9fd460dee4c41fc.tar.gz
bcm5719-llvm-f2e5bd8d2226ce30de60b8d4c9fd460dee4c41fc.zip
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. llvm-svn: 65182
Diffstat (limited to 'llvm/utils/lint/common_lint.py')
-rw-r--r--llvm/utils/lint/common_lint.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/utils/lint/common_lint.py b/llvm/utils/lint/common_lint.py
index 18263838b09..e08c93cb170 100644
--- a/llvm/utils/lint/common_lint.py
+++ b/llvm/utils/lint/common_lint.py
@@ -15,7 +15,7 @@ def VerifyLineLength(filename, lines, max_length):
"""
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 @@ def VerifyTrailingWhitespace(filename, lines):
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
OpenPOWER on IntegriCloud