llvm.org GIT mirror llvm / 814f69e
Fix inverted regex search. I was using the pattern as the source string and vice versa causing strange regular expression errors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313590 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 2 years ago
1 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
147147 output, _ = llvm_config_cmd.communicate()
148148 output = output.decode(encoding)
149149 lines = output.split('\n')
150 for (line, (_, patterns)) in zip(lines, features):
150 for (feature_line, (_, patterns)) in zip(lines, features):
151151 # We should have either a callable or a dictionary. If it's a
152152 # dictionary, grep each key against the output and use the value if
153153 # it matches. If it's a callable, it does the entire translation.
154154 if callable(patterns):
155 features_to_add = patterns(line)
155 features_to_add = patterns(feature_line)
156156 self.config.available_features.update(features_to_add)
157157 else:
158 for (match, feature) in patterns.items():
159 if re.search(line, match):
158 for (re_pattern, feature) in patterns.items():
159 if re.search(re_pattern, feature_line):
160160 self.config.available_features.add(feature)