From: Zachary Turner Date: Mon, 18 Sep 2017 23:14:15 +0000 (+0000) Subject: Fix inverted regex search. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=814f69e3692fe436c502c75524aa52dd727b33c1;p=llvm 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 --- diff --git a/utils/lit/lit/llvm/config.py b/utils/lit/lit/llvm/config.py index 175aa699327..cd1f8eea750 100644 --- a/utils/lit/lit/llvm/config.py +++ b/utils/lit/lit/llvm/config.py @@ -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)