]> granicus.if.org Git - llvm/commitdiff
Fix inverted regex search.
authorZachary Turner <zturner@google.com>
Mon, 18 Sep 2017 23:14:15 +0000 (23:14 +0000)
committerZachary Turner <zturner@google.com>
Mon, 18 Sep 2017 23:14:15 +0000 (23:14 +0000)
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

utils/lit/lit/llvm/config.py

index 175aa699327c7680249f24a1b7adbf1a019a5824..cd1f8eea75038db672da869d0a69e1050863517d 100644 (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)