[Reproducers] Support capturing a reproducer without an explicit path.

Tablegen doesn't support options that are both flags and take values as
an argument. I noticed this when doing the tablegen rewrite, but forgot
that that affected the reproducer --capture flag.

This patch makes --capture a flag and adds --capture-path to specify a
path for the reproducer. In reality I expect this to be mostly used for
testing, but it could be useful nonetheless.

Differential revision: https://reviews.llvm.org/D59238

llvm-svn: 355936
This commit is contained in:
Jonas Devlieghere
2019-03-12 16:44:18 +00:00
parent 5c1177a68f
commit 13ecae2f9a
11 changed files with 73 additions and 30 deletions

View File

@@ -2940,6 +2940,15 @@ SBRegistry::SBRegistry() {
}
}
const char *SBReproducer::Capture() {
static std::string error;
if (auto e = Reproducer::Initialize(ReproducerMode::Capture, llvm::None)) {
error = llvm::toString(std::move(e));
return error.c_str();
}
return nullptr;
}
const char *SBReproducer::Capture(const char *path) {
static std::string error;
if (auto e =