[Lldb-commits] [lldb] r330047 - [Command] Simplify the code and make it less error prone. NFCI.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 13 11:37:14 PDT 2018


Author: davide
Date: Fri Apr 13 11:37:14 2018
New Revision: 330047

URL: http://llvm.org/viewvc/llvm-project?rev=330047&view=rev
Log:
[Command] Simplify the code and make it less error prone. NFCI.

Pointed out by Jim.

Modified:
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Commands/CommandObjectFrame.cpp

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=330047&r1=330046&r2=330047&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Apr 13 11:37:14 2018
@@ -623,10 +623,7 @@ bool CommandObjectExpression::DoExecute(
   if (expr == nullptr)
     expr = command;
 
-  Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
-  if (!target)
-    target = GetDummyTarget();
-
+  Target *target = GetSelectedOrDummyTarget();
   if (EvaluateExpression(expr, &(result.GetOutputStream()),
                          &(result.GetErrorStream()), &result)) {
 

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=330047&r1=330046&r2=330047&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Fri Apr 13 11:37:14 2018
@@ -722,9 +722,7 @@ protected:
 
     // Increment statistics.
     bool res = result.Succeeded();
-    Target *target = m_exe_ctx.GetTargetPtr();
-    if (!target)
-      target = GetDummyTarget();
+    Target *target = GetSelectedOrDummyTarget();
     if (res)
       target->IncrementStats(StatisticKind::FrameVarSuccess);
     else




More information about the lldb-commits mailing list