]> granicus.if.org Git - clang/commitdiff
Driver: Pass -ivfsoverlay to module crashdumps
authorJustin Bogner <mail@justinbogner.com>
Fri, 27 Jun 2014 06:35:05 +0000 (06:35 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 27 Jun 2014 06:35:05 +0000 (06:35 +0000)
When we create a crashdump involving modules, we build a VFS to
reproduce the problem with. This updates the reproduction script to
use that VFS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211876 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
test/Driver/crash-report-modules.m

index e3b53a9983f307e70f35abff3d67d863726e86f6..a18312a84fa08ca4c1c18e3bf87d2362640b64b6 100644 (file)
@@ -522,9 +522,13 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
       std::string Script = StringRef(*it).rsplit('.').first;
       // In some cases (modules) we'll dump extra data to help with reproducing
       // the crash into a directory next to the output.
-      if (llvm::sys::fs::exists(Script + ".cache"))
+      SmallString<128> VFS;
+      if (llvm::sys::fs::exists(Script + ".cache")) {
         Diag(clang::diag::note_drv_command_failed_diag_msg)
             << Script + ".cache";
+        VFS = llvm::sys::path::filename(Script + ".cache");
+        llvm::sys::path::append(VFS, "vfs", "vfs.yaml");
+      }
 
       std::string Err;
       Script += ".sh";
@@ -546,6 +550,9 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
         E = I + OldFilename.size();
         I = Cmd.rfind(" ", I) + 1;
         Cmd.replace(I, E - I, NewFilename.data(), NewFilename.size());
+        // Add the VFS overlay to the reproduction script.
+        I += NewFilename.size();
+        Cmd.insert(I, std::string(" -ivfsoverlay ") + VFS.c_str());
         ScriptOS << Cmd;
         Diag(clang::diag::note_drv_command_failed_diag_msg) << Script;
       }
index ff805ed453a483ff09c1f3da46065fe4decdb1a9..d1c7832019cf4e7fe2ae90dfa7305ee231364c5a 100644 (file)
@@ -28,3 +28,5 @@ const int x = MODULE_MACRO;
 // CHECKSH: -cc1
 // CHECKSH: -D "FOO=BAR"
 // CHECKSH-NOT: -fmodules-cache-path=/tmp/
+// CHECKSH: crash-report-modules-{{[^ ]*}}.m
+// CHECKSH: -ivfsoverlay crash-report-modules-{{[^ ]*}}.cache/vfs/vfs.yaml