[clang] 1f44a0b - Make minor improvements to the creduce wrapper script

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 15:09:15 PDT 2024


Author: Reid Kleckner
Date: 2024-04-29T22:09:09Z
New Revision: 1f44a0b1ff2daebe10b9916da228f7c0ba66827c

URL: https://github.com/llvm/llvm-project/commit/1f44a0b1ff2daebe10b9916da228f7c0ba66827c
DIFF: https://github.com/llvm/llvm-project/commit/1f44a0b1ff2daebe10b9916da228f7c0ba66827c.diff

LOG: Make minor improvements to the creduce wrapper script

Use shlex.quote instead of pipes.quote. We don't need to support Python
2.7 anymore.

Remove -fcolor-diagnostics first, because that can sometimes interfere
with the interestingness test.

Added: 
    

Modified: 
    clang/utils/creduce-clang-crash.py

Removed: 
    


################################################################################
diff  --git a/clang/utils/creduce-clang-crash.py b/clang/utils/creduce-clang-crash.py
index 27361bb8850581..4d0c8224d8b499 100755
--- a/clang/utils/creduce-clang-crash.py
+++ b/clang/utils/creduce-clang-crash.py
@@ -15,7 +15,6 @@
 import stat
 import sys
 import subprocess
-import pipes
 import shlex
 import tempfile
 import shutil
@@ -61,7 +60,7 @@ def check_cmd(cmd_name, cmd_dir, cmd_path=None):
 
 
 def quote_cmd(cmd):
-    return " ".join(pipes.quote(arg) for arg in cmd)
+    return " ".join(shlex.quote(arg) for arg in cmd)
 
 
 def write_to_script(text, filename):
@@ -220,7 +219,7 @@ def write_interestingness_test(self):
         )
 
         for msg in self.expected_output:
-            output += "grep -F %s t.log || exit 1\n" % pipes.quote(msg)
+            output += "grep -F %s t.log || exit 1\n" % shlex.quote(msg)
 
         write_to_script(output, self.testfile)
         self.check_interestingness()
@@ -318,9 +317,17 @@ def simplify_clang_args(self):
         interestingness test takes to run.
         """
         print("\nSimplifying the clang command...")
+        new_args = self.clang_args
+
+        # Remove the color diagnostics flag to make it easier to match error
+        # text.
+        new_args = self.try_remove_args(
+            new_args,
+            msg="Removed -fcolor-diagnostics",
+            opts_equal=["-fcolor-diagnostics"],
+        )
 
         # Remove some clang arguments to speed up the interestingness test
-        new_args = self.clang_args
         new_args = self.try_remove_args(
             new_args,
             msg="Removed debug info options",


        


More information about the cfe-commits mailing list