r359054 - Fixes in creduce-clang-crash.py for clang crash message parsing and reading the command from the repro script.

Amy Huang via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 17:28:23 PDT 2019


Author: akhuang
Date: Tue Apr 23 17:28:23 2019
New Revision: 359054

URL: http://llvm.org/viewvc/llvm-project?rev=359054&view=rev
Log:
Fixes in creduce-clang-crash.py for clang crash message parsing and reading the command from the repro script.

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

Modified: cfe/trunk/utils/creduce-clang-crash.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/creduce-clang-crash.py?rev=359054&r1=359053&r2=359054&view=diff
==============================================================================
--- cfe/trunk/utils/creduce-clang-crash.py (original)
+++ cfe/trunk/utils/creduce-clang-crash.py Tue Apr 23 17:28:23 2019
@@ -93,9 +93,14 @@ class Reduce(object):
   def read_clang_args(self, crash_script, filename):
     print("\nReading arguments from crash script...")
     with open(crash_script) as f:
-      # Assume clang call is on the last line of the script
-      line = f.readlines()[-1]
-      cmd = shlex.split(line)
+      # Assume clang call is the first non comment line.
+      cmd = []
+      for line in f:
+        if not line.lstrip().startswith('#'):
+          cmd = shlex.split(line)
+          break
+    if not cmd:
+      sys.exit("Could not find command in the crash script.");
 
     # Remove clang and filename from the command
     # Assume the last occurrence of the filename is the clang input file
@@ -122,7 +127,7 @@ class Reduce(object):
     # Look for specific error messages
     regexes = [r"Assertion `(.+)' failed", # Linux assert()
                r"Assertion failed: (.+),", # FreeBSD/Mac assert()
-               r"fatal error: backend error: (.+)",
+               r"fatal error: error in backend: (.+)",
                r"LLVM ERROR: (.+)",
                r"UNREACHABLE executed (at .+)?!",
                r"LLVM IR generation of ceclaration '(.+)'",




More information about the cfe-commits mailing list