================
@@ -250,35 +296,57 @@ def check_no_diagnosis(self, clang_tidy_output: str) -> 
None:
         if clang_tidy_output != "":
             sys.exit("No diagnostics were expected, but found the ones above")
 
-    def check_fixes(self) -> None:
-        if self.has_check_fixes:
-            try_run(
-                [
-                    "FileCheck",
-                    "--input-file=" + self.temp_file_name,
-                    self.input_file_name,
-                    "--check-prefixes=" + ",".join(self.fixes.prefixes),
-                    (
-                        "--match-full-lines"
-                        if not self.match_partial_fixes
-                        else "--strict-whitespace"  # Keeping past behavior.
-                    ),
-                ]
-            )
+    def check_fixes(self, input_file: str = "", check_file: str = "") -> None:
+        if not check_file and not self.has_check_fixes:
+            return
 
-    def check_messages(self, clang_tidy_output: str) -> None:
-        if self.has_check_messages:
-            messages_file = self.temp_file_name + ".msg"
-            write_file(messages_file, clang_tidy_output)
-            try_run(
-                [
-                    "FileCheck",
-                    "-input-file=" + messages_file,
-                    self.input_file_name,
-                    "-check-prefixes=" + ",".join(self.messages.prefixes),
-                    "-implicit-check-not={{warning|error}}:",
-                ]
-            )
+        input_file = input_file or self.temp_file_name
+        check_file = check_file or self.input_file_name
+        active_prefixes = self._filter_prefixes(self.fixes.prefixes, 
check_file)
+
+        if not active_prefixes:
+            return
+
+        try_run(
+            [
+                "FileCheck",
+                "--input-file=" + input_file,
+                check_file,
+                "--check-prefixes=" + ",".join(active_prefixes),
+                (
+                    "--match-full-lines"
+                    if not self.match_partial_fixes
+                    else "--strict-whitespace"  # Keeping past behavior.
+                ),
+            ]
+        )
+
+    def check_messages(
+        self,
+        clang_tidy_output: str,
+        messages_file: str = "",
+        check_file: str = "",
+    ) -> None:
+        if not check_file and not self.has_check_messages:
+            return
+
+        messages_file = messages_file or (self.temp_file_name + ".msg")
----------------
EugeneZelenko wrote:

Please use f-string.

https://github.com/llvm/llvm-project/pull/175735
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to