]> granicus.if.org Git - clang/commitdiff
[CrashReproducer] Add -fmodule-cache-path to reproducer script
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 1 Apr 2016 17:39:08 +0000 (17:39 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 1 Apr 2016 17:39:08 +0000 (17:39 +0000)
The cc1 invocation in the reproducer script should contain a valid path in
-fmodule-cache-path; for that reuse "<name>.cache/module" dir we already
use to dump the vfs and modules.

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

lib/Driver/Job.cpp
test/Modules/crash-vfs-path-emptydir-entries.m
test/Modules/crash-vfs-path-symlink-component.m
test/Modules/crash-vfs-path-symlink-topheader.m
test/Modules/crash-vfs-path-traversal.m
test/Modules/crash-vfs-relative-overlay.m

index 3eb23c9ee4c955517bcd59c8dad9a4dba3e35852..d44458db2fbe2d5cfd570a291f912d4a097e4c0f 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
@@ -194,6 +195,18 @@ void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote,
     printArg(OS, "-ivfsoverlay", Quote);
     OS << ' ';
     printArg(OS, CrashInfo->VFSPath.str().c_str(), Quote);
+
+    // Insert -fmodules-cache-path and use the relative module directory
+    // <name>.cache/vfs/modules where we already dumped the modules.
+    SmallString<128> RelModCacheDir = llvm::sys::path::parent_path(
+        llvm::sys::path::parent_path(CrashInfo->VFSPath));
+    llvm::sys::path::append(RelModCacheDir, "modules");
+
+    std::string ModCachePath = "-fmodules-cache-path=";
+    ModCachePath.append(RelModCacheDir.c_str());
+
+    OS << ' ';
+    printArg(OS, ModCachePath.c_str(), Quote);
   }
 
   if (ResponseFile != nullptr) {
index 444c4556b51f189aa24f9177df4e64bff8e4ad26..01560984ff710577f33135192d40a79d8549014d 100644 (file)
@@ -37,6 +37,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
 
 // CHECKYAML: 'type': 'directory',
 // CHECKYAML: 'name': "",
index 9687cc9a15f8a468bcd541e61ad4a66c25403510..674f80ea7f1fdb4ccf1d65cded29e80efe135aca 100644 (file)
@@ -38,6 +38,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
 
 // CHECKYAML: 'type': 'directory'
 // CHECKYAML: 'name': "/[[PATH:.*]]/i/usr/include",
index 29f6b9322dfc41b10d1c68bc741afa5bc6191e6c..72b666a8127cd0efbe865ad2c635f05a71a68415 100644 (file)
@@ -39,6 +39,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
 
 // CHECKYAML: 'type': 'directory',
 // CHECKYAML: 'name': "",
index 60e73d4fb909dd71ed46a63de5e44afd7a1f9617..822a0dc2068196b008592ccee699e4cfe5c84b68 100644 (file)
@@ -35,6 +35,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
 
 // CHECKYAML:     'type': 'directory'
 // CHECKYAML:     'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",
index d4e1e0d3dfa3a3c9246cba9dfbd1c031e02bb502..d157b1339251f028bc8be2c108f3c6d88acae6c8 100644 (file)
@@ -33,6 +33,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
 
 // CHECKYAML: 'type': 'directory'
 // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",