diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-09 21:47:49 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-10-09 21:47:49 +0000 |
commit | 865cd0932f4483058ccc607b8867a4a5a597ec52 (patch) | |
tree | 6604e8b66f791b897f7428901d34c2928fc2ce36 | |
parent | 00f9e5aa76f4932098da375545ee144d884eced3 (diff) | |
download | bcm5719-llvm-865cd0932f4483058ccc607b8867a4a5a597ec52.tar.gz bcm5719-llvm-865cd0932f4483058ccc607b8867a4a5a597ec52.zip |
[Reproducer] Add convenience methods IsCapturing and IsReplaying.
Add convenience methods to the Reproducer class for when you don't need
access to the generator and the loader.
llvm-svn: 374236
-rw-r--r-- | lldb/include/lldb/Utility/Reproducer.h | 3 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectReproducer.cpp | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h index 1ad7638eec4..7fde9c3e58b 100644 --- a/lldb/include/lldb/Utility/Reproducer.h +++ b/lldb/include/lldb/Utility/Reproducer.h @@ -313,6 +313,9 @@ public: FileSpec GetReproducerPath() const; + bool IsCapturing() { return static_cast<bool>(m_generator); }; + bool IsReplaying() { return static_cast<bool>(m_loader); }; + protected: llvm::Error SetCapture(llvm::Optional<FileSpec> root); llvm::Error SetReplay(llvm::Optional<FileSpec> root); diff --git a/lldb/source/Commands/CommandObjectReproducer.cpp b/lldb/source/Commands/CommandObjectReproducer.cpp index 404702d3640..424595fc0bd 100644 --- a/lldb/source/Commands/CommandObjectReproducer.cpp +++ b/lldb/source/Commands/CommandObjectReproducer.cpp @@ -88,7 +88,7 @@ protected: auto &r = Reproducer::Instance(); if (auto generator = r.GetGenerator()) { generator->Keep(); - } else if (r.GetLoader()) { + } else if (r.IsReplaying()) { // Make this operation a NOP in replay mode. result.SetStatus(eReturnStatusSuccessFinishNoResult); return result.Succeeded(); @@ -132,9 +132,9 @@ protected: } auto &r = Reproducer::Instance(); - if (r.GetGenerator()) { + if (r.IsCapturing()) { result.GetOutputStream() << "Reproducer is in capture mode.\n"; - } else if (r.GetLoader()) { + } else if (r.IsReplaying()) { result.GetOutputStream() << "Reproducer is in replay mode.\n"; } else { result.GetOutputStream() << "Reproducer is off.\n"; |