@@ -53,12 +53,12 @@ def nm_get_symbols(tool, lib):
53
53
# The -P flag displays the size field for symbols only when applicable,
54
54
# so the last field is optional. There's no space after the value field,
55
55
# but \s+ match newline also, so \s+\S* will match the optional size field.
56
- match = re .match ("^(\S+)\s+[BDGRSTuVW]\s+\S+\s+\S*$" , line )
56
+ match = re .match (r "^(\S+)\s+[BDGRSTuVW]\s+\S+\s+\S*$" , line )
57
57
if match :
58
58
yield (match .group (1 ), True )
59
59
# Look for undefined symbols, which have type U and may or may not
60
60
# (depending on which nm is being used) have value and size.
61
- match = re .match ("^(\S+)\s+U\s+(\S+\s+\S*)?$" , line )
61
+ match = re .match (r "^(\S+)\s+U\s+(\S+\s+\S*)?$" , line )
62
62
if match :
63
63
yield (match .group (1 ), False )
64
64
process .wait ()
@@ -71,7 +71,7 @@ def readobj_is_32bit_windows(tool, lib):
71
71
[tool , "--file-header" , lib ], universal_newlines = True
72
72
)
73
73
for line in output .splitlines ():
74
- match = re .match ("Format: (\S+)" , line )
74
+ match = re .match (r "Format: (\S+)" , line )
75
75
if match :
76
76
return match .group (1 ) == "COFF-i386"
77
77
return False
@@ -85,7 +85,7 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration):
85
85
if not "?" in symbol :
86
86
if calling_convention_decoration :
87
87
# Remove calling convention decoration from names
88
- match = re .match ("[_@]([^@]+)" , symbol )
88
+ match = re .match (r "[_@]([^@]+)" , symbol )
89
89
if match :
90
90
symbol = match .group (1 )
91
91
# Discard floating point/SIMD constants.
@@ -100,10 +100,10 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration):
100
100
# An anonymous namespace is mangled as ?A(maybe hex number)@. Any symbol
101
101
# that mentions an anonymous namespace can be discarded, as the anonymous
102
102
# namespace doesn't exist outside of that translation unit.
103
- elif re .search ("\?A(0x\w+)?@" , symbol ):
103
+ elif re .search (r "\?A(0x\w+)?@" , symbol ):
104
104
return None
105
105
# Skip X86GenMnemonicTables functions, they are not exposed from llvm/include/.
106
- elif re .match ("\?is[A-Z0-9]*@X86@llvm" , symbol ):
106
+ elif re .match (r "\?is[A-Z0-9]*@X86@llvm" , symbol ):
107
107
return None
108
108
# Keep mangled llvm:: and clang:: function symbols. How we detect these is a
109
109
# bit of a mess and imprecise, but that avoids having to completely demangle
@@ -123,7 +123,7 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration):
123
123
# ::= .+@ (list of types)
124
124
# ::= .*Z (list of types, varargs)
125
125
# <throw-spec> ::= exceptions are not allowed
126
- elif re .search ("(llvm|clang)@@[A-Z][A-Z0-9_]*[A-JQ].+(X|.+@|.*Z)$" , symbol ):
126
+ elif re .search (r "(llvm|clang)@@[A-Z][A-Z0-9_]*[A-JQ].+(X|.+@|.*Z)$" , symbol ):
127
127
return symbol
128
128
return None
129
129
@@ -140,7 +140,7 @@ def should_keep_itanium_symbol(symbol, calling_convention_decoration):
140
140
if not symbol .startswith ("_" ) and not symbol .startswith ("." ):
141
141
return symbol
142
142
# Discard manglings that aren't nested names
143
- match = re .match ("\.?_Z(T[VTIS])?(N.+)" , symbol )
143
+ match = re .match (r "\.?_Z(T[VTIS])?(N.+)" , symbol )
144
144
if not match :
145
145
return None
146
146
# Demangle the name. If the name is too complex then we don't need to keep
@@ -169,19 +169,19 @@ class TooComplexName(Exception):
169
169
# (name, rest of string) pair.
170
170
def parse_itanium_name (arg ):
171
171
# Check for a normal name
172
- match = re .match ("(\d+)(.+)" , arg )
172
+ match = re .match (r "(\d+)(.+)" , arg )
173
173
if match :
174
174
n = int (match .group (1 ))
175
175
name = match .group (1 ) + match .group (2 )[:n ]
176
176
rest = match .group (2 )[n :]
177
177
return name , rest
178
178
# Check for constructor/destructor names
179
- match = re .match ("([CD][123])(.+)" , arg )
179
+ match = re .match (r "([CD][123])(.+)" , arg )
180
180
if match :
181
181
return match .group (1 ), match .group (2 )
182
182
# Assume that a sequence of characters that doesn't end a nesting is an
183
183
# operator (this is very imprecise, but appears to be good enough)
184
- match = re .match ("([^E]+)(.+)" , arg )
184
+ match = re .match (r "([^E]+)(.+)" , arg )
185
185
if match :
186
186
return match .group (1 ), match .group (2 )
187
187
# Anything else: we can't handle it
@@ -196,13 +196,13 @@ def skip_itanium_template(arg):
196
196
tmp = arg [1 :]
197
197
while tmp :
198
198
# Check for names
199
- match = re .match ("(\d+)(.+)" , tmp )
199
+ match = re .match (r "(\d+)(.+)" , tmp )
200
200
if match :
201
201
n = int (match .group (1 ))
202
202
tmp = match .group (2 )[n :]
203
203
continue
204
204
# Check for substitutions
205
- match = re .match ("S[A-Z0-9]*_(.+)" , tmp )
205
+ match = re .match (r "S[A-Z0-9]*_(.+)" , tmp )
206
206
if match :
207
207
tmp = match .group (1 )
208
208
# Start of a template
@@ -231,14 +231,14 @@ def parse_itanium_nested_name(arg):
231
231
ret = []
232
232
233
233
# Skip past the N, and possibly a substitution
234
- match = re .match ("NS[A-Z0-9]*_(.+)" , arg )
234
+ match = re .match (r "NS[A-Z0-9]*_(.+)" , arg )
235
235
if match :
236
236
tmp = match .group (1 )
237
237
else :
238
238
tmp = arg [1 :]
239
239
240
240
# Skip past CV-qualifiers and ref qualifiers
241
- match = re .match ("[rVKRO]*(.+)" , tmp )
241
+ match = re .match (r "[rVKRO]*(.+)" , tmp )
242
242
if match :
243
243
tmp = match .group (1 )
244
244
@@ -280,19 +280,19 @@ def parse_microsoft_mangling(arg):
280
280
if arg .startswith ("@" ):
281
281
return components
282
282
# Check for a simple name
283
- match = re .match ("(\w+)@(.+)" , arg )
283
+ match = re .match (r "(\w+)@(.+)" , arg )
284
284
if match :
285
285
components .append ((match .group (1 ), False ))
286
286
arg = match .group (2 )
287
287
continue
288
288
# Check for a special function name
289
- match = re .match ("(\?_?\w)(.+)" , arg )
289
+ match = re .match (r "(\?_?\w)(.+)" , arg )
290
290
if match :
291
291
components .append ((match .group (1 ), False ))
292
292
arg = match .group (2 )
293
293
continue
294
294
# Check for a template name
295
- match = re .match ("\?\$(\w+)@[^@]+@(.+)" , arg )
295
+ match = re .match (r "\?\$(\w+)@[^@]+@(.+)" , arg )
296
296
if match :
297
297
components .append ((match .group (1 ), True ))
298
298
arg = match .group (2 )
@@ -323,7 +323,7 @@ def get_template_name(sym, mangling):
323
323
if mangling == "microsoft" :
324
324
names = parse_microsoft_mangling (sym )
325
325
else :
326
- match = re .match ("\.?_Z(T[VTIS])?(N.+)" , sym )
326
+ match = re .match (r "\.?_Z(T[VTIS])?(N.+)" , sym )
327
327
if match :
328
328
names , _ = parse_itanium_nested_name (match .group (2 ))
329
329
else :
0 commit comments