blob: eb8101cf3efb0b1024c6b51c5aa959546e180809 [file] [log] [blame]
Chandler Carruth06a5dd62015-01-12 04:43:18 +00001#!/usr/bin/env python2.7
2
3"""A test case update script.
4
5This script is a utility to update LLVM X86 'llc' based test cases with new
6FileCheck patterns. It can either update all of the tests in the file or
7a single test function.
8"""
9
10import argparse
Sanjay Patel506fd0d2016-03-24 17:30:38 +000011import os # Used to advertise this file's name ("autogenerated_note").
Chandler Carruth06a5dd62015-01-12 04:43:18 +000012import string
13import subprocess
14import sys
Chandler Carruth06a5dd62015-01-12 04:43:18 +000015import re
16
Sanjay Patelbf623012016-03-23 21:40:53 +000017# Invoke the tool that is being tested.
Chandler Carruth06a5dd62015-01-12 04:43:18 +000018def llc(args, cmd_args, ir):
19 with open(ir) as ir_file:
20 stdout = subprocess.check_output(args.llc_binary + ' ' + cmd_args,
21 shell=True, stdin=ir_file)
Simon Pilgrim6b6dcc42016-01-27 21:13:18 +000022 # Fix line endings to unix CR style.
23 stdout = stdout.replace('\r\n', '\n')
Chandler Carruth06a5dd62015-01-12 04:43:18 +000024 return stdout
25
26
Sanjay Patelbf623012016-03-23 21:40:53 +000027# RegEx: this is where the magic happens.
28
29SCRUB_WHITESPACE_RE = re.compile(r'(?!^(| \w))[ \t]+', flags=re.M)
30SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M)
Eli Friedman1a9a8872016-12-19 23:09:51 +000031SCRUB_KILL_COMMENT_RE = re.compile(r'^ *#+ +kill:.*\n')
Tim Shence26a452017-03-23 16:02:47 +000032SCRUB_LOOP_COMMENT_RE = re.compile(
33 r'# =>This Inner Loop Header:.*|# in Loop:.*', flags=re.M)
Eli Friedman1a9a8872016-12-19 23:09:51 +000034
35ASM_FUNCTION_X86_RE = re.compile(
36 r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n[^:]*?'
37 r'(?P<body>^##?[ \t]+[^:]+:.*?)\s*'
Chandler Carruth5c69dac2017-08-25 02:32:48 +000038 r'^\s*(?:[^:\n]+?:\s*\n\s*\.size|\.cfi_endproc|\.globl|\.comm|\.(?:sub)?section|# -- End function)',
Eli Friedman1a9a8872016-12-19 23:09:51 +000039 flags=(re.M | re.S))
Sanjay Patelbf623012016-03-23 21:40:53 +000040SCRUB_X86_SHUFFLES_RE = (
Chandler Carruth06a5dd62015-01-12 04:43:18 +000041 re.compile(
Simon Pilgrim7c2fbdc2016-07-03 13:08:29 +000042 r'^(\s*\w+) [^#\n]+#+ ((?:[xyz]mm\d+|mem)( \{%k\d+\}( \{z\})?)? = .*)$',
Chandler Carruth06a5dd62015-01-12 04:43:18 +000043 flags=re.M))
Sanjay Patelbf623012016-03-23 21:40:53 +000044SCRUB_X86_SP_RE = re.compile(r'\d+\(%(esp|rsp)\)')
45SCRUB_X86_RIP_RE = re.compile(r'[.\w]+\(%rip\)')
Simon Pilgrim2b7c02a2016-06-11 20:39:21 +000046SCRUB_X86_LCP_RE = re.compile(r'\.LCPI[0-9]+_[0-9]+')
Eli Friedman1a9a8872016-12-19 23:09:51 +000047
48ASM_FUNCTION_ARM_RE = re.compile(
49 r'^(?P<func>[0-9a-zA-Z_]+):\n' # f: (name of function)
50 r'\s+\.fnstart\n' # .fnstart
51 r'(?P<body>.*?)\n' # (body of the function)
Chandler Carruth5c69dac2017-08-25 02:32:48 +000052 r'.Lfunc_end[0-9]+:', # .Lfunc_end0: or # -- End function
Eli Friedman1a9a8872016-12-19 23:09:51 +000053 flags=(re.M | re.S))
Sanjay Patelbf623012016-03-23 21:40:53 +000054
55RUN_LINE_RE = re.compile('^\s*;\s*RUN:\s*(.*)$')
Tim Shen53ddc1d2016-12-22 20:59:39 +000056TRIPLE_ARG_RE = re.compile(r'-mtriple=([^ ]+)')
57TRIPLE_IR_RE = re.compile(r'^target\s+triple\s*=\s*"([^"]+)"$')
Sanjay Patelbf623012016-03-23 21:40:53 +000058IR_FUNCTION_RE = re.compile('^\s*define\s+(?:internal\s+)?[^@]*@(\w+)\s*\(')
Nikolai Bozhenov33ee40e2017-01-14 09:39:35 +000059CHECK_PREFIX_RE = re.compile('--?check-prefix(?:es)?=(\S+)')
Sanjay Patelbf623012016-03-23 21:40:53 +000060CHECK_RE = re.compile(r'^\s*;\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:')
Chandler Carruth06a5dd62015-01-12 04:43:18 +000061
Tim Shen53ddc1d2016-12-22 20:59:39 +000062ASM_FUNCTION_PPC_RE = re.compile(
63 r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
64 r'\.Lfunc_begin[0-9]+:\n'
65 r'[ \t]+.cfi_startproc\n'
66 r'(?:\.Lfunc_[gl]ep[0-9]+:\n(?:[ \t]+.*?\n)*)*'
67 r'(?P<body>.*?)\n'
68 # This list is incomplete
69 r'(?:^[ \t]*(?:\.long[ \t]+[^\n]+|\.quad[ \t]+[^\n]+)\n)*'
70 r'.Lfunc_end[0-9]+:\n',
71 flags=(re.M | re.S))
72
Jonas Paulssonf20386d2017-03-17 07:11:42 +000073ASM_FUNCTION_SYSTEMZ_RE = re.compile(
74 r'^_?(?P<func>[^:]+):[ \t]*#+[ \t]*@(?P=func)\n'
75 r'[ \t]+.cfi_startproc\n'
76 r'(?P<body>.*?)\n'
77 r'.Lfunc_end[0-9]+:\n',
78 flags=(re.M | re.S))
79
Chandler Carruth06a5dd62015-01-12 04:43:18 +000080
Eli Friedman1a9a8872016-12-19 23:09:51 +000081def scrub_asm_x86(asm):
Chandler Carruth06a5dd62015-01-12 04:43:18 +000082 # Scrub runs of whitespace out of the assembly, but leave the leading
83 # whitespace in place.
Sanjay Patelbf623012016-03-23 21:40:53 +000084 asm = SCRUB_WHITESPACE_RE.sub(r' ', asm)
Chandler Carruth06a5dd62015-01-12 04:43:18 +000085 # Expand the tabs used for indentation.
86 asm = string.expandtabs(asm, 2)
87 # Detect shuffle asm comments and hide the operands in favor of the comments.
Sanjay Patelbf623012016-03-23 21:40:53 +000088 asm = SCRUB_X86_SHUFFLES_RE.sub(r'\1 {{.*#+}} \2', asm)
Chandler Carruth06a5dd62015-01-12 04:43:18 +000089 # Generically match the stack offset of a memory operand.
Sanjay Patelbf623012016-03-23 21:40:53 +000090 asm = SCRUB_X86_SP_RE.sub(r'{{[0-9]+}}(%\1)', asm)
Chandler Carruth06a5dd62015-01-12 04:43:18 +000091 # Generically match a RIP-relative memory operand.
Sanjay Patelbf623012016-03-23 21:40:53 +000092 asm = SCRUB_X86_RIP_RE.sub(r'{{.*}}(%rip)', asm)
Simon Pilgrim2b7c02a2016-06-11 20:39:21 +000093 # Generically match a LCP symbol.
94 asm = SCRUB_X86_LCP_RE.sub(r'{{\.LCPI.*}}', asm)
Chandler Carruth06a5dd62015-01-12 04:43:18 +000095 # Strip kill operands inserted into the asm.
Sanjay Patelbf623012016-03-23 21:40:53 +000096 asm = SCRUB_KILL_COMMENT_RE.sub('', asm)
Chandler Carruthe3750952015-02-04 10:46:48 +000097 # Strip trailing whitespace.
Sanjay Patelbf623012016-03-23 21:40:53 +000098 asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
Chandler Carruth06a5dd62015-01-12 04:43:18 +000099 return asm
100
Tim Shen53ddc1d2016-12-22 20:59:39 +0000101def scrub_asm_arm_eabi(asm):
Eli Friedman1a9a8872016-12-19 23:09:51 +0000102 # Scrub runs of whitespace out of the assembly, but leave the leading
103 # whitespace in place.
104 asm = SCRUB_WHITESPACE_RE.sub(r' ', asm)
105 # Expand the tabs used for indentation.
106 asm = string.expandtabs(asm, 2)
107 # Strip kill operands inserted into the asm.
108 asm = SCRUB_KILL_COMMENT_RE.sub('', asm)
109 # Strip trailing whitespace.
110 asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
111 return asm
112
Tim Shen53ddc1d2016-12-22 20:59:39 +0000113def scrub_asm_powerpc64le(asm):
114 # Scrub runs of whitespace out of the assembly, but leave the leading
115 # whitespace in place.
116 asm = SCRUB_WHITESPACE_RE.sub(r' ', asm)
117 # Expand the tabs used for indentation.
118 asm = string.expandtabs(asm, 2)
Tim Shence26a452017-03-23 16:02:47 +0000119 # Stripe unimportant comments
120 asm = SCRUB_LOOP_COMMENT_RE.sub(r'', asm)
Tim Shen53ddc1d2016-12-22 20:59:39 +0000121 # Strip trailing whitespace.
122 asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
123 return asm
124
Jonas Paulssonf20386d2017-03-17 07:11:42 +0000125def scrub_asm_systemz(asm):
126 # Scrub runs of whitespace out of the assembly, but leave the leading
127 # whitespace in place.
128 asm = SCRUB_WHITESPACE_RE.sub(r' ', asm)
129 # Expand the tabs used for indentation.
130 asm = string.expandtabs(asm, 2)
131 # Strip trailing whitespace.
132 asm = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
133 return asm
134
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000135
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000136# Build up a dictionary of all the function bodies.
Tim Shen53ddc1d2016-12-22 20:59:39 +0000137def build_function_body_dictionary(raw_tool_output, triple, prefixes, func_dict,
138 verbose):
139 target_handlers = {
140 'x86_64': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
141 'i686': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
142 'x86': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
143 'i386': (scrub_asm_x86, ASM_FUNCTION_X86_RE),
144 'arm-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
Sanjay Patel588e4152017-02-24 21:47:44 +0000145 'thumb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
146 'thumbv8-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
Eli Friedman7e0ce822017-02-24 03:04:11 +0000147 'armeb-eabi': (scrub_asm_arm_eabi, ASM_FUNCTION_ARM_RE),
Tim Shen53ddc1d2016-12-22 20:59:39 +0000148 'powerpc64le': (scrub_asm_powerpc64le, ASM_FUNCTION_PPC_RE),
Jonas Paulssonf20386d2017-03-17 07:11:42 +0000149 's390x': (scrub_asm_systemz, ASM_FUNCTION_SYSTEMZ_RE),
Tim Shen53ddc1d2016-12-22 20:59:39 +0000150 }
151 handlers = None
152 for prefix, s in target_handlers.items():
153 if triple.startswith(prefix):
154 handlers = s
155 break
156 else:
157 raise KeyError('Triple %r is not supported' % (triple))
158
159 scrubber, function_re = handlers
Eli Friedman1a9a8872016-12-19 23:09:51 +0000160 for m in function_re.finditer(raw_tool_output):
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000161 if not m:
162 continue
163 func = m.group('func')
Tim Shen53ddc1d2016-12-22 20:59:39 +0000164 scrubbed_body = scrubber(m.group('body'))
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000165 if func.startswith('stress'):
166 # We only use the last line of the function body for stress tests.
167 scrubbed_body = '\n'.join(scrubbed_body.splitlines()[-1:])
168 if verbose:
169 print >>sys.stderr, 'Processing function: ' + func
170 for l in scrubbed_body.splitlines():
171 print >>sys.stderr, ' ' + l
172 for prefix in prefixes:
173 if func in func_dict[prefix] and func_dict[prefix][func] != scrubbed_body:
174 if prefix == prefixes[-1]:
175 print >>sys.stderr, ('WARNING: Found conflicting asm under the '
176 'same prefix: %r!' % (prefix,))
177 else:
178 func_dict[prefix][func] = None
179 continue
180
181 func_dict[prefix][func] = scrubbed_body
182
183
Tim Shen53ddc1d2016-12-22 20:59:39 +0000184def add_checks(output_lines, run_list, func_dict, func_name):
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000185 printed_prefixes = []
Tim Shen53ddc1d2016-12-22 20:59:39 +0000186 for p in run_list:
187 checkprefixes = p[0]
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000188 for checkprefix in checkprefixes:
189 if checkprefix in printed_prefixes:
190 break
191 if not func_dict[checkprefix][func_name]:
192 continue
193 # Add some space between different check prefixes.
194 if len(printed_prefixes) != 0:
195 output_lines.append(';')
196 printed_prefixes.append(checkprefix)
197 output_lines.append('; %s-LABEL: %s:' % (checkprefix, func_name))
198 func_body = func_dict[checkprefix][func_name].splitlines()
199 output_lines.append('; %s: %s' % (checkprefix, func_body[0]))
200 for func_line in func_body[1:]:
201 output_lines.append('; %s-NEXT: %s' % (checkprefix, func_line))
202 # Add space between different check prefixes and the first line of code.
203 # output_lines.append(';')
204 break
205 return output_lines
206
207
208def should_add_line_to_output(input_line, prefix_set):
209 # Skip any blank comment lines in the IR.
210 if input_line.strip() == ';':
211 return False
212 # Skip any blank lines in the IR.
213 #if input_line.strip() == '':
214 # return False
215 # And skip any CHECK lines. We're building our own.
216 m = CHECK_RE.match(input_line)
217 if m and m.group(1) in prefix_set:
218 return False
219
220 return True
221
222
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000223def main():
224 parser = argparse.ArgumentParser(description=__doc__)
225 parser.add_argument('-v', '--verbose', action='store_true',
226 help='Show verbose output')
227 parser.add_argument('--llc-binary', default='llc',
228 help='The "llc" binary to use to generate the test case')
229 parser.add_argument(
230 '--function', help='The function in the test file to update')
231 parser.add_argument('tests', nargs='+')
232 args = parser.parse_args()
233
James Y Knight7c905062015-11-23 21:33:58 +0000234 autogenerated_note = ('; NOTE: Assertions have been autogenerated by '
Simon Pilgrim2b7c02a2016-06-11 20:39:21 +0000235 'utils/' + os.path.basename(__file__))
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000236
237 for test in args.tests:
238 if args.verbose:
239 print >>sys.stderr, 'Scanning for RUN lines in test file: %s' % (test,)
240 with open(test) as f:
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000241 input_lines = [l.rstrip() for l in f]
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000242
Tim Shen53ddc1d2016-12-22 20:59:39 +0000243 triple_in_ir = None
244 for l in input_lines:
245 m = TRIPLE_IR_RE.match(l)
246 if m:
247 triple_in_ir = m.groups()[0]
248 break
249
Bryant Wong291264b2016-12-29 19:32:34 +0000250 raw_lines = [m.group(1)
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000251 for m in [RUN_LINE_RE.match(l) for l in input_lines] if m]
Bryant Wong291264b2016-12-29 19:32:34 +0000252 run_lines = [raw_lines[0]] if len(raw_lines) > 0 else []
253 for l in raw_lines[1:]:
Bryant Wong507256b2016-12-29 20:05:51 +0000254 if run_lines[-1].endswith("\\"):
255 run_lines[-1] = run_lines[-1].rstrip("\\") + " " + l
256 else:
257 run_lines.append(l)
Bryant Wong291264b2016-12-29 19:32:34 +0000258
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000259 if args.verbose:
260 print >>sys.stderr, 'Found %d RUN lines:' % (len(run_lines),)
261 for l in run_lines:
262 print >>sys.stderr, ' RUN: ' + l
263
Tim Shen53ddc1d2016-12-22 20:59:39 +0000264 run_list = []
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000265 for l in run_lines:
Zvi Rackover35a5acf2016-11-07 17:47:21 +0000266 commands = [cmd.strip() for cmd in l.split('|', 1)]
267 llc_cmd = commands[0]
Tim Shen53ddc1d2016-12-22 20:59:39 +0000268
269 triple_in_cmd = None
270 m = TRIPLE_ARG_RE.search(llc_cmd)
271 if m:
272 triple_in_cmd = m.groups()[0]
273
Zvi Rackover35a5acf2016-11-07 17:47:21 +0000274 filecheck_cmd = ''
275 if len(commands) > 1:
276 filecheck_cmd = commands[1]
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000277 if not llc_cmd.startswith('llc '):
278 print >>sys.stderr, 'WARNING: Skipping non-llc RUN line: ' + l
279 continue
280
281 if not filecheck_cmd.startswith('FileCheck '):
282 print >>sys.stderr, 'WARNING: Skipping non-FileChecked RUN line: ' + l
283 continue
284
285 llc_cmd_args = llc_cmd[len('llc'):].strip()
286 llc_cmd_args = llc_cmd_args.replace('< %s', '').replace('%s', '').strip()
287
Nikolai Bozhenov33ee40e2017-01-14 09:39:35 +0000288 check_prefixes = [item for m in CHECK_PREFIX_RE.finditer(filecheck_cmd)
289 for item in m.group(1).split(',')]
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000290 if not check_prefixes:
291 check_prefixes = ['CHECK']
292
293 # FIXME: We should use multiple check prefixes to common check lines. For
294 # now, we just ignore all but the last.
Tim Shen53ddc1d2016-12-22 20:59:39 +0000295 run_list.append((check_prefixes, llc_cmd_args, triple_in_cmd))
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000296
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000297 func_dict = {}
Tim Shen53ddc1d2016-12-22 20:59:39 +0000298 for p in run_list:
299 prefixes = p[0]
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000300 for prefix in prefixes:
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000301 func_dict.update({prefix: dict()})
Tim Shen53ddc1d2016-12-22 20:59:39 +0000302 for prefixes, llc_args, triple_in_cmd in run_list:
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000303 if args.verbose:
304 print >>sys.stderr, 'Extracted LLC cmd: llc ' + llc_args
305 print >>sys.stderr, 'Extracted FileCheck prefixes: ' + str(prefixes)
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000306
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000307 raw_tool_output = llc(args, llc_args, test)
Tim Shen53ddc1d2016-12-22 20:59:39 +0000308 if not (triple_in_cmd or triple_in_ir):
309 print >>sys.stderr, "Cannot find a triple. Assume 'x86'"
310
311 build_function_body_dictionary(raw_tool_output,
312 triple_in_cmd or triple_in_ir or 'x86', prefixes, func_dict, args.verbose)
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000313
314 is_in_function = False
315 is_in_function_start = False
Zvi Rackover18082ab2016-11-07 18:08:19 +0000316 func_name = None
Tim Shen53ddc1d2016-12-22 20:59:39 +0000317 prefix_set = set([prefix for p in run_list for prefix in p[0]])
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000318 if args.verbose:
319 print >>sys.stderr, 'Rewriting FileCheck prefixes: %s' % (prefix_set,)
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000320 output_lines = []
321 output_lines.append(autogenerated_note)
James Y Knight7c905062015-11-23 21:33:58 +0000322
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000323 for input_line in input_lines:
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000324 if is_in_function_start:
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000325 if input_line == '':
326 continue
327 if input_line.lstrip().startswith(';'):
328 m = CHECK_RE.match(input_line)
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000329 if not m or m.group(1) not in prefix_set:
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000330 output_lines.append(input_line)
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000331 continue
332
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000333 # Print out the various check lines here.
Tim Shen53ddc1d2016-12-22 20:59:39 +0000334 output_lines = add_checks(output_lines, run_list, func_dict, func_name)
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000335 is_in_function_start = False
336
337 if is_in_function:
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000338 if should_add_line_to_output(input_line, prefix_set) == True:
339 # This input line of the function body will go as-is into the output.
340 output_lines.append(input_line)
341 else:
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000342 continue
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000343 if input_line.strip() == '}':
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000344 is_in_function = False
345 continue
346
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000347 if input_line == autogenerated_note:
James Y Knight7c905062015-11-23 21:33:58 +0000348 continue
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000349
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000350 # If it's outside a function, it just gets copied to the output.
351 output_lines.append(input_line)
352
353 m = IR_FUNCTION_RE.match(input_line)
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000354 if not m:
355 continue
Zvi Rackover18082ab2016-11-07 18:08:19 +0000356 func_name = m.group(1)
357 if args.function is not None and func_name != args.function:
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000358 # When filtering on a specific function, skip all others.
359 continue
360 is_in_function = is_in_function_start = True
361
362 if args.verbose:
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000363 print>>sys.stderr, 'Writing %d lines to %s...' % (len(output_lines), test)
364
Simon Pilgrim6b6dcc42016-01-27 21:13:18 +0000365 with open(test, 'wb') as f:
Sanjay Patelf3c5f462016-03-24 17:15:42 +0000366 f.writelines([l + '\n' for l in output_lines])
Chandler Carruth06a5dd62015-01-12 04:43:18 +0000367
368
369if __name__ == '__main__':
370 main()