[llvm] r264542 - add scrubber for excessive leading whitespace
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 27 13:43:02 PDT 2016
Author: spatel
Date: Sun Mar 27 15:43:02 2016
New Revision: 264542
URL: http://llvm.org/viewvc/llvm-project?rev=264542&view=rev
Log:
add scrubber for excessive leading whitespace
Modified:
llvm/trunk/utils/update_test_checks.py
Modified: llvm/trunk/utils/update_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_test_checks.py?rev=264542&r1=264541&r2=264542&view=diff
==============================================================================
--- llvm/trunk/utils/update_test_checks.py (original)
+++ llvm/trunk/utils/update_test_checks.py Sun Mar 27 15:43:02 2016
@@ -19,6 +19,7 @@ import re
# RegEx: this is where the magic happens.
+SCRUB_LEADING_WHITESPACE_RE = re.compile(r'^(\s+)')
SCRUB_WHITESPACE_RE = re.compile(r'(?!^(| \w))[ \t]+', flags=re.M)
SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M)
SCRUB_X86_SHUFFLES_RE = (
@@ -321,6 +322,8 @@ def main():
if is_in_function:
if should_add_line_to_output(input_line, prefix_set) == True:
# This input line of the function body will go as-is into the output.
+ # Except make leading whitespace uniform: 2 spaces.
+ input_line = SCRUB_LEADING_WHITESPACE_RE.sub(r' ', input_line)
output_lines.append(input_line)
else:
continue
More information about the llvm-commits
mailing list