7 '\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*'
18 annoying_pos
= s
.find("{{[^(]+}}")
19 if annoying_pos
!= -1:
20 at_pos
= annoying_pos
+ 9
22 paren_pos
= s
.find("(", at_pos
)
26 res
= s
[: paren_pos
+ 1]
27 s
= s
[paren_pos
+ 1 :]
33 if s
.startswith(",") or s
.startswith(")"):
37 next_arg
= s
.find(",")
41 res
+= s
[: next_arg
+ 1]
48 def process_file(contents
):
49 PREFIX
= re
.compile(r
"check-prefix(es)?(=|\s+)([a-zA-Z0-9,]+)")
50 check_prefixes
= ["CHECK"]
52 for line
in contents
.split("\n"):
53 if "FileCheck" in line
:
54 m
= PREFIX
.search(line
)
56 check_prefixes
.extend(m
.group(3).split(","))
59 for prefix
in check_prefixes
:
64 if not found_check
or "define" not in line
:
68 # We have a check for a function definition. Number the args.
69 line
= fix_string(line
)
75 print(f
"Processing {sys.argv[1]}")
80 content
= process_file(content
)
82 f
= open(sys
.argv
[1], "w")
87 if __name__
== "__main__":