summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-06-27 06:35:05 +0000
committerJustin Bogner <mail@justinbogner.com>2014-06-27 06:35:05 +0000
commitdb5f8b25707a23dd5852a35539775f7e8cf8896e (patch)
tree9d1fd1584d22a52dcfcd952c8af002fd2d7a12b5
parent602e633a37d50865953ffcc41b0520edc58778a8 (diff)
downloadclang-db5f8b25707a23dd5852a35539775f7e8cf8896e.tar.gz
clang-db5f8b25707a23dd5852a35539775f7e8cf8896e.tar.bz2
clang-db5f8b25707a23dd5852a35539775f7e8cf8896e.tar.xz
Driver: Pass -ivfsoverlay to module crashdumps
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
-rw-r--r--lib/Driver/Driver.cpp9
-rw-r--r--test/Driver/crash-report-modules.m2
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp
index e3b53a9983..a18312a84f 100644
--- a/lib/Driver/Driver.cpp
+++ b/lib/Driver/Driver.cpp
@@ -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;
}
diff --git a/test/Driver/crash-report-modules.m b/test/Driver/crash-report-modules.m
index ff805ed453..d1c7832019 100644
--- a/test/Driver/crash-report-modules.m
+++ b/test/Driver/crash-report-modules.m
@@ -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