From 68ed93d2528f28e04c8b96dde59225d4cc87ff3a Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 27 Nov 2018 22:11:02 +0000 Subject: [Reproducers] Improve reproducer API and add unit tests. When I landed the initial reproducer framework I knew there were some things that needed improvement. Rather than bundling it with a patch that adds more functionality I split it off into this patch. I also think the API is stable enough to add unit testing, which is included in this patch as well. Other improvements include: - Refactor how we initialize the loader and generator. - Improve naming consistency: capture and replay seems the least ambiguous. - Index providers by name and make sure there's only one of each. - Add convenience methods for creating and accessing providers. Differential revision: https://reviews.llvm.org/D54616 llvm-svn: 347716 --- lldb/source/Commands/CommandObjectReproducer.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'lldb/source/Commands/CommandObjectReproducer.cpp') diff --git a/lldb/source/Commands/CommandObjectReproducer.cpp b/lldb/source/Commands/CommandObjectReproducer.cpp index a1fdb4a1fcd..03a3e230980 100644 --- a/lldb/source/Commands/CommandObjectReproducer.cpp +++ b/lldb/source/Commands/CommandObjectReproducer.cpp @@ -143,25 +143,13 @@ protected: auto &r = repro::Reproducer::Instance(); - if (auto e = r.SetReplayReproducer(true)) { + const char *repro_path = command.GetArgumentAtIndex(0); + if (auto e = r.SetReplay(FileSpec(repro_path))) { std::string error_str = llvm::toString(std::move(e)); result.AppendErrorWithFormat("%s", error_str.c_str()); return false; } - if (auto loader = r.GetLoader()) { - const char *repro_path = command.GetArgumentAtIndex(0); - if (auto e = loader->LoadIndex(FileSpec(repro_path))) { - std::string error_str = llvm::toString(std::move(e)); - result.AppendErrorWithFormat("Unable to load reproducer: %s", - error_str.c_str()); - return false; - } - } else { - result.AppendErrorWithFormat("Unable to get the reproducer loader"); - return false; - } - result.SetStatus(eReturnStatusSuccessFinishNoResult); return result.Succeeded(); } -- cgit v1.2.3