[Lldb-commits] [lldb] 5212206 - [lldb] Make Reproducer compatbile with SubsystemRAII (NFC)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 25 13:00:15 PDT 2020
Author: Jonas Devlieghere
Date: 2020-08-25T13:00:04-07:00
New Revision: 521220690ab7741e382344319b2a9d458be3eb41
URL: https://github.com/llvm/llvm-project/commit/521220690ab7741e382344319b2a9d458be3eb41
DIFF: https://github.com/llvm/llvm-project/commit/521220690ab7741e382344319b2a9d458be3eb41.diff
LOG: [lldb] Make Reproducer compatbile with SubsystemRAII (NFC)
Make Reproducer compatbile with SubsystemRAII and use it in
LocateSymbolFileTest.
Added:
Modified:
lldb/include/lldb/Utility/Reproducer.h
lldb/source/Utility/Reproducer.cpp
lldb/unittests/Symbol/LocateSymbolFileTest.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h
index d3d6589a7ef87..d6cde44850901 100644
--- a/lldb/include/lldb/Utility/Reproducer.h
+++ b/lldb/include/lldb/Utility/Reproducer.h
@@ -197,6 +197,7 @@ class Reproducer {
static Reproducer &Instance();
static llvm::Error Initialize(ReproducerMode mode,
llvm::Optional<FileSpec> root);
+ static void Initialize();
static bool Initialized();
static void Terminate();
diff --git a/lldb/source/Utility/Reproducer.cpp b/lldb/source/Utility/Reproducer.cpp
index 9276c7449d7b2..68c64195f55ee 100644
--- a/lldb/source/Utility/Reproducer.cpp
+++ b/lldb/source/Utility/Reproducer.cpp
@@ -73,6 +73,10 @@ llvm::Error Reproducer::Initialize(ReproducerMode mode,
return Error::success();
}
+void Reproducer::Initialize() {
+ llvm::cantFail(Initialize(repro::ReproducerMode::Off, llvm::None));
+}
+
bool Reproducer::Initialized() { return InstanceImpl().operator bool(); }
void Reproducer::Terminate() {
diff --git a/lldb/unittests/Symbol/LocateSymbolFileTest.cpp b/lldb/unittests/Symbol/LocateSymbolFileTest.cpp
index a2f9be56635d1..c51b1ba490461 100644
--- a/lldb/unittests/Symbol/LocateSymbolFileTest.cpp
+++ b/lldb/unittests/Symbol/LocateSymbolFileTest.cpp
@@ -21,29 +21,22 @@ using namespace lldb_private;
namespace {
class SymbolsTest : public ::testing::Test {
public:
- SubsystemRAII<FileSystem, HostInfo> subsystems;
+ SubsystemRAII<repro::Reproducer, FileSystem, HostInfo> subsystems;
};
} // namespace
TEST_F(
SymbolsTest,
TerminateLocateExecutableSymbolFileForUnknownExecutableAndUnknownSymbolFile) {
- EXPECT_THAT_ERROR(
- repro::Reproducer::Initialize(repro::ReproducerMode::Off, llvm::None),
- llvm::Succeeded());
ModuleSpec module_spec;
FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
FileSpec symbol_file_spec =
Symbols::LocateExecutableSymbolFile(module_spec, search_paths);
EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty());
- repro::Reproducer::Terminate();
}
TEST_F(SymbolsTest,
LocateExecutableSymbolFileForUnknownExecutableAndMissingSymbolFile) {
- EXPECT_THAT_ERROR(
- repro::Reproducer::Initialize(repro::ReproducerMode::Off, llvm::None),
- llvm::Succeeded());
ModuleSpec module_spec;
// using a GUID here because the symbol file shouldn't actually exist on disk
module_spec.GetSymbolFileSpec().SetFile(
@@ -52,5 +45,4 @@ TEST_F(SymbolsTest,
FileSpec symbol_file_spec =
Symbols::LocateExecutableSymbolFile(module_spec, search_paths);
EXPECT_TRUE(symbol_file_spec.GetFilename().IsEmpty());
- repro::Reproducer::Terminate();
}
More information about the lldb-commits
mailing list