[Lldb-commits] [lldb] r219869 - Give old_state a default value so we won't try to restore

Jason Molenda jmolenda at apple.com
Wed Oct 15 16:39:32 PDT 2014


Author: jmolenda
Date: Wed Oct 15 18:39:31 2014
New Revision: 219869

URL: http://llvm.org/viewvc/llvm-project?rev=219869&view=rev
Log:
Give old_state a default value so we won't try to restore
an uninitialized value.  In reality the code block that 
initializes it and the code block that restores it will always
match up - but the analyzer doesn't know that and I want to 
quiet it, so...
clang static analyzer fixit.

Modified:
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=219869&r1=219868&r2=219869&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Oct 15 18:39:31 2014
@@ -4975,7 +4975,7 @@ Process::RunThreadPlan (ExecutionContext
     }
 
     HostThread backup_private_state_thread;
-    lldb::StateType old_state;
+    lldb::StateType old_state = eStateInvalid;
     lldb::ThreadPlanSP stopper_base_plan_sp;
     
     Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_PROCESS));
@@ -5593,8 +5593,8 @@ Process::RunThreadPlan (ExecutionContext
             {
                 thread->DiscardThreadPlansUpToPlan(stopper_base_plan_sp);
             }
-            m_public_state.SetValueNoLock(old_state);
-
+            if (old_state != eStateInvalid)
+                m_public_state.SetValueNoLock(old_state);
         }
 
         // Restore the thread state if we are going to discard the plan execution.  There are three cases where this





More information about the lldb-commits mailing list