[CrashReproducer] Add -fmodule-cache-path to reproducer script

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.

llvm-svn: 265162
This commit is contained in:
Bruno Cardoso Lopes 2016-04-01 17:39:08 +00:00
parent 9f413364d5
commit f854b042e7
6 changed files with 18 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h" #include "llvm/ADT/StringSet.h"
#include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Program.h" #include "llvm/Support/Program.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <cassert> #include <cassert>
@ -194,6 +195,18 @@ void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote,
printArg(OS, "-ivfsoverlay", Quote); printArg(OS, "-ivfsoverlay", Quote);
OS << ' '; OS << ' ';
printArg(OS, CrashInfo->VFSPath.str().c_str(), Quote); 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) { if (ResponseFile != nullptr) {

View File

@ -37,6 +37,7 @@
// CHECKSH-NOT: "-fmodules-cache-path=" // CHECKSH-NOT: "-fmodules-cache-path="
// CHECKSH: "crash-vfs-{{[^ ]*}}.m" // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
// CHECKYAML: 'type': 'directory', // CHECKYAML: 'type': 'directory',
// CHECKYAML: 'name': "", // CHECKYAML: 'name': "",

View File

@ -38,6 +38,7 @@
// CHECKSH-NOT: "-fmodules-cache-path=" // CHECKSH-NOT: "-fmodules-cache-path="
// CHECKSH: "crash-vfs-{{[^ ]*}}.m" // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
// CHECKYAML: 'type': 'directory' // CHECKYAML: 'type': 'directory'
// CHECKYAML: 'name': "/[[PATH:.*]]/i/usr/include", // CHECKYAML: 'name': "/[[PATH:.*]]/i/usr/include",

View File

@ -39,6 +39,7 @@
// CHECKSH-NOT: "-fmodules-cache-path=" // CHECKSH-NOT: "-fmodules-cache-path="
// CHECKSH: "crash-vfs-{{[^ ]*}}.m" // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
// CHECKYAML: 'type': 'directory', // CHECKYAML: 'type': 'directory',
// CHECKYAML: 'name': "", // CHECKYAML: 'name': "",

View File

@ -35,6 +35,7 @@
// CHECKSH-NOT: "-fmodules-cache-path=" // CHECKSH-NOT: "-fmodules-cache-path="
// CHECKSH: "crash-vfs-{{[^ ]*}}.m" // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
// CHECKYAML: 'type': 'directory' // CHECKYAML: 'type': 'directory'
// CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include", // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",

View File

@ -33,6 +33,7 @@
// CHECKSH-NOT: "-fmodules-cache-path=" // CHECKSH-NOT: "-fmodules-cache-path="
// CHECKSH: "crash-vfs-{{[^ ]*}}.m" // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
// CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml" // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
// CHECKYAML: 'type': 'directory' // CHECKYAML: 'type': 'directory'
// CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include", // CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/crash-recovery/usr/include",