Fix inverted regex search.

I was using the pattern as the source string and vice versa
causing strange regular expression errors.

llvm-svn: 313590
This commit is contained in:
Zachary Turner 2017-09-18 23:14:15 +00:00
parent 4de620ab3d
commit bbf8f23ed9
1 changed files with 4 additions and 4 deletions

View File

@ -148,14 +148,14 @@ class LLVMConfig(object):
output, _ = llvm_config_cmd.communicate()
output = output.decode(encoding)
lines = output.split('\n')
for (line, (_, patterns)) in zip(lines, features):
for (feature_line, (_, patterns)) in zip(lines, features):
# We should have either a callable or a dictionary. If it's a
# dictionary, grep each key against the output and use the value if
# it matches. If it's a callable, it does the entire translation.
if callable(patterns):
features_to_add = patterns(line)
features_to_add = patterns(feature_line)
self.config.available_features.update(features_to_add)
else:
for (match, feature) in patterns.items():
if re.search(line, match):
for (re_pattern, feature) in patterns.items():
if re.search(re_pattern, feature_line):
self.config.available_features.add(feature)