[Lldb-commits] [lldb] r374236 - [Reproducer] Add convenience methods IsCapturing and IsReplaying.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 14:47:50 PDT 2019


Author: jdevlieghere
Date: Wed Oct  9 14:47:49 2019
New Revision: 374236

URL: http://llvm.org/viewvc/llvm-project?rev=374236&view=rev
Log:
[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.

Modified:
    lldb/trunk/include/lldb/Utility/Reproducer.h
    lldb/trunk/source/Commands/CommandObjectReproducer.cpp

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=374236&r1=374235&r2=374236&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Wed Oct  9 14:47:49 2019
@@ -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);

Modified: lldb/trunk/source/Commands/CommandObjectReproducer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectReproducer.cpp?rev=374236&r1=374235&r2=374236&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectReproducer.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectReproducer.cpp Wed Oct  9 14:47:49 2019
@@ -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";




More information about the lldb-commits mailing list