Skip to content

Commit 865cd09

Browse files
committed
[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
1 parent 00f9e5a commit 865cd09

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lldb/include/lldb/Utility/Reproducer.h

+3
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ class Reproducer {
313313

314314
FileSpec GetReproducerPath() const;
315315

316+
bool IsCapturing() { return static_cast<bool>(m_generator); };
317+
bool IsReplaying() { return static_cast<bool>(m_loader); };
318+
316319
protected:
317320
llvm::Error SetCapture(llvm::Optional<FileSpec> root);
318321
llvm::Error SetReplay(llvm::Optional<FileSpec> root);

lldb/source/Commands/CommandObjectReproducer.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class CommandObjectReproducerGenerate : public CommandObjectParsed {
8888
auto &r = Reproducer::Instance();
8989
if (auto generator = r.GetGenerator()) {
9090
generator->Keep();
91-
} else if (r.GetLoader()) {
91+
} else if (r.IsReplaying()) {
9292
// Make this operation a NOP in replay mode.
9393
result.SetStatus(eReturnStatusSuccessFinishNoResult);
9494
return result.Succeeded();
@@ -132,9 +132,9 @@ class CommandObjectReproducerStatus : public CommandObjectParsed {
132132
}
133133

134134
auto &r = Reproducer::Instance();
135-
if (r.GetGenerator()) {
135+
if (r.IsCapturing()) {
136136
result.GetOutputStream() << "Reproducer is in capture mode.\n";
137-
} else if (r.GetLoader()) {
137+
} else if (r.IsReplaying()) {
138138
result.GetOutputStream() << "Reproducer is in replay mode.\n";
139139
} else {
140140
result.GetOutputStream() << "Reproducer is off.\n";

0 commit comments

Comments
 (0)