5 TYPE
= re
.compile('\s*(i[0-9]+|float|double|x86_fp80|fp128|ppc_fp128|\[\[.*?\]\]|\[2 x \[\[[A-Z_0-9]+\]\]\]|<.*?>|{.*?}|\[[0-9]+ x .*?\]|%["a-z:A-Z0-9._]+({{.*?}})?|%{{.*?}}|{{.*?}}|\[\[.*?\]\])(\s*(\*|addrspace\(.*?\)|dereferenceable\(.*?\)|byval\(.*?\)|sret|zeroext|inreg|returned|signext|nocapture|align \d+|swiftself|swifterror|readonly|noalias|inalloca|nocapture))*\s*')
15 annoying_pos
= s
.find('{{[^(]+}}')
16 if annoying_pos
!= -1:
17 at_pos
= annoying_pos
+ 9
19 paren_pos
= s
.find('(', at_pos
)
30 if s
.startswith(',') or s
.startswith(')'):
34 next_arg
= s
.find(',')
44 def process_file(contents
):
45 PREFIX
= re
.compile(r
'check-prefix(es)?(=|\s+)([a-zA-Z0-9,]+)')
46 check_prefixes
= ['CHECK']
48 for line
in contents
.split('\n'):
49 if 'FileCheck' in line
:
50 m
= PREFIX
.search(line
)
52 check_prefixes
.extend(m
.group(3).split(','))
55 for prefix
in check_prefixes
:
60 if not found_check
or 'define' not in line
:
64 # We have a check for a function definition. Number the args.
65 line
= fix_string(line
)
70 print(f
'Processing {sys.argv[1]}')
75 content
= process_file(content
)
77 f
= open(sys
.argv
[1], 'w')
81 if __name__
== '__main__':