[Lldb-commits] [lldb] r177332 - Code cleanup:

Greg Clayton gclayton at apple.com
Mon Mar 18 15:34:00 PDT 2013


Author: gclayton
Date: Mon Mar 18 17:34:00 2013
New Revision: 177332

URL: http://llvm.org/viewvc/llvm-project?rev=177332&view=rev
Log:
Code cleanup:
- don't use preprocessor macros
- use switch statements
- don't put anything in the lldb namespace, use "lldb_perf" namespace.
- Pass the action struct into each TestStep() for each step fill in
- Modify the ActionWanted class to have accessors to make the continue, next, finish, kill instead of using preproc macros


Modified:
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/tools/lldb-perf/darwin/formatters/main.cpp
    lldb/trunk/tools/lldb-perf/darwin/sketch/main.cpp
    lldb/trunk/tools/lldb-perf/lib/Gauge.h
    lldb/trunk/tools/lldb-perf/lib/Measurement.h
    lldb/trunk/tools/lldb-perf/lib/MemoryGauge.cpp
    lldb/trunk/tools/lldb-perf/lib/MemoryGauge.h
    lldb/trunk/tools/lldb-perf/lib/Metric.cpp
    lldb/trunk/tools/lldb-perf/lib/Metric.h
    lldb/trunk/tools/lldb-perf/lib/TestCase.cpp
    lldb/trunk/tools/lldb-perf/lib/TestCase.h
    lldb/trunk/tools/lldb-perf/lib/Timer.cpp
    lldb/trunk/tools/lldb-perf/lib/Timer.h
    lldb/trunk/tools/lldb-perf/lib/Xcode.cpp
    lldb/trunk/tools/lldb-perf/lib/Xcode.h

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Mon Mar 18 17:34:00 2013
@@ -3330,11 +3330,11 @@
 		26F5C22410F3D950009D5894 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
-				940DB8C416EA64D400D3C2F1 /* lldb-perf */,
 				26579F55126A255E0007C5CB /* darwin-debug */,
 				265E9BE0115C2B8500D0DCCB /* debugserver */,
 				26F5C22510F3D956009D5894 /* Driver */,
 				2665CD0915080846002C8FAE /* install-headers */,
+				940DB8C416EA64D400D3C2F1 /* lldb-perf */,
 				26DC6A1B1337FEA400FF7998 /* lldb-platform */,
 			);
 			name = Tools;

Modified: lldb/trunk/tools/lldb-perf/darwin/formatters/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/darwin/formatters/main.cpp?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/darwin/formatters/main.cpp (original)
+++ lldb/trunk/tools/lldb-perf/darwin/formatters/main.cpp Mon Mar 18 17:34:00 2013
@@ -18,7 +18,7 @@
 #include <unistd.h>
 #include <fstream>
 
-using namespace lldb::perf;
+using namespace lldb_perf;
 
 class FormattersTest : public TestCase
 {
@@ -26,40 +26,40 @@ public:
     FormattersTest () : TestCase()
     {
         m_dump_std_vector_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "std-vector", "time to dump an std::vector");
         m_dump_std_list_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "std-list", "time to dump an std::list");
         m_dump_std_map_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "std-map", "time to dump an std::map");
         m_dump_std_string_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "std-string", "time to dump an std::string");
         
         m_dump_nsstring_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,0,false);
+            lldb_perf::Xcode::FetchVariable (value,0,false);
         }, "ns-string", "time to dump an NSString");
         
         m_dump_nsarray_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "ns-array", "time to dump an NSArray");
         
         m_dump_nsdictionary_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "ns-dictionary", "time to dump an NSDictionary");
         
         m_dump_nsset_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "ns-set", "time to dump an NSSet");
         
         m_dump_nsbundle_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,1,false);
+            lldb_perf::Xcode::FetchVariable (value,1,false);
         }, "ns-bundle", "time to dump an NSBundle");
         
         m_dump_nsdate_measurement = CreateTimeMeasurement([] (SBValue value) -> void {
-            lldb::perf::Xcode::FetchVariable (value,0,false);
+            lldb_perf::Xcode::FetchVariable (value,0,false);
         }, "ns-date", "time to dump an NSDate");
     }
 
@@ -138,71 +138,59 @@ public:
         m_dump_std_string_measurement(frame_zero.FindVariable("sstr4", lldb::eDynamicCanRunTarget));
     }
     
-    virtual ActionWanted
-	TestStep (int counter)
+	virtual void
+	TestStep (int counter, ActionWanted &next_action)
     {
-#define STEP(n) if (counter == n)
-#define NEXT(s) return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWNext,SelectMyThread(s)}
-#define FINISH(s) return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWFinish,SelectMyThread(s)}
-#define CONT return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWContinue,SBThread()}
-#define KILL return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWKill,SBThread()}
-        STEP (0)
+        switch (counter)
         {
-            m_target.BreakpointCreateByLocation("fmts_tester.mm", 68);
-            CONT;
+            case 0:
+                m_target.BreakpointCreateByLocation("fmts_tester.mm", 68);
+                next_action.Continue();
+                break;
+            case 1:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 2:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 3:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 4:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 5:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 6:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 7:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 8:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 9:
+                DoTest ();
+                next_action.Continue();
+                break;
+            case 10:
+                DoTest ();
+                next_action.Continue();
+                break;
+            default:
+                next_action.Kill();
+                break;
         }
-        
-        STEP (1)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (2)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (3)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (4)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (5)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (6)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (7)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (8)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (9)
-        {
-            DoTest ();
-            CONT;
-        }
-        STEP (10)
-        {
-            DoTest ();
-            CONT;
-        }
-        KILL;
     }
     
     void

Modified: lldb/trunk/tools/lldb-perf/darwin/sketch/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/darwin/sketch/main.cpp?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/darwin/sketch/main.cpp (original)
+++ lldb/trunk/tools/lldb-perf/darwin/sketch/main.cpp Mon Mar 18 17:34:00 2013
@@ -18,7 +18,7 @@
 #include <unistd.h>
 #include <fstream>
 
-using namespace lldb::perf;
+using namespace lldb_perf;
 
 class SketchTest : public TestCase
 {
@@ -82,73 +82,98 @@ public:
         m_fetch_vars_measurement(m_process,1);
     }
     
-	virtual ActionWanted
-	TestStep (int counter)
+	virtual void
+	TestStep (int counter, ActionWanted &next_action)
     {
-#define STEP(n) if (counter == n)
-#define NEXT(s) return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWNext,SelectMyThread(s)}
-#define FINISH(s) return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWFinish,SelectMyThread(s)}
-#define CONT return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWContinue,SBThread()}
-#define KILL return TestCase::ActionWanted{TestCase::ActionWanted::Type::eAWKill,SBThread()}
-        STEP(0) {
-            DoTest ();
-            m_file_line_bp_measurement(m_target, "SKTDocument.m",254);
-            CONT;
-        }
-        STEP(1) {
-            DoTest ();
-            SBThread thread(SelectMyThread("SKTDocument.m"));
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"properties");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"[properties description]");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"typeName");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"data");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"[data description]");
-            CONT;
-        }
-        STEP(2) {
-            DoTest ();
-            CONT;
-        }
-        STEP(3) {
-            DoTest ();
-            NEXT("SKTText.m");
-        }
-        STEP(4) {
-            DoTest ();
-            SBThread thread(SelectMyThread("SKTText.m"));
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"layoutManager");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"contents");
-            NEXT("SKTText.m");
-        }
-        STEP(5) {
-            DoTest ();
-            NEXT("SKTText.m");
-        }
-        STEP(6) {
-            DoTest ();
-            NEXT("SKTText.m");
-        }
-        STEP(7) {
-            DoTest ();
-            SBThread thread(SelectMyThread("SKTText.m"));
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"@\"an NSString\"");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"[(id)@\"an NSString\" description]");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"@[@1, at 2, at 3]");
-            FINISH("SKTText.m");
-        }
-        STEP(8) {
-            DoTest ();
-            SBThread thread(SelectMyThread("SKTGraphicView.m"));
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"[graphics description]");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"[selectionIndexes description]");
-            m_run_expr_measurement(thread.GetFrameAtIndex(0),"(BOOL)NSIntersectsRect(rect, graphicDrawingBounds)");
-            KILL;
+        switch (counter)
+        {
+        case 0:
+            {
+                DoTest ();
+                m_file_line_bp_measurement(m_target, "SKTDocument.m",254);
+                next_action.Continue();
+            }
+            break;
+                
+        case 1:
+            {
+                DoTest ();
+                SBThread thread(SelectMyThread("SKTDocument.m"));
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"properties");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"[properties description]");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"typeName");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"data");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"[data description]");
+                next_action.Continue();
+            }
+            break;
+
+        case 2:
+            {
+                DoTest ();
+                next_action.Continue();
+            }
+            break;
+
+        case 3:
+            {
+                DoTest ();
+                next_action.Next(SelectMyThread ("SKTText.m"));
+            }
+            break;
+
+        case 4:
+            {
+                DoTest ();
+                SBThread thread(SelectMyThread("SKTText.m"));
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"layoutManager");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"contents");
+                next_action.Next(thread);
+            }
+            break;
+        
+        case 5:
+            {
+                DoTest ();
+                next_action.Next(SelectMyThread ("SKTText.m"));
+            }
+            break;
+
+        case 6:
+            {
+                DoTest ();
+                next_action.Next(SelectMyThread ("SKTText.m"));
+            }
+            break;
+
+        case 7:
+            {
+                DoTest ();
+                SBThread thread(SelectMyThread("SKTText.m"));
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"@\"an NSString\"");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"[(id)@\"an NSString\" description]");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"@[@1, at 2, at 3]");
+                next_action.Finish(thread);
+            }
+            break;
+
+        case 8:
+            {
+                DoTest ();
+                SBThread thread(SelectMyThread("SKTGraphicView.m"));
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"[graphics description]");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"[selectionIndexes description]");
+                m_run_expr_measurement(thread.GetFrameAtIndex(0),"(BOOL)NSIntersectsRect(rect, graphicDrawingBounds)");
+                next_action.Kill();
+            }
+            break;
+        
+        default:
+            {
+                next_action.Kill();
+            }
+            break;
         }
-        KILL;
-#undef STEP
-#undef NEXT
-#undef CONT
-#undef KILL
     }
     
     void
@@ -169,11 +194,11 @@ public:
     }
     
 private:
-    Measurement<lldb::perf::TimeGauge, std::function<void(SBProcess)>> m_fetch_frames_measurement;
-    Measurement<lldb::perf::TimeGauge, std::function<void(SBTarget, const char*, uint32_t)>> m_file_line_bp_measurement;
-    Measurement<lldb::perf::TimeGauge, std::function<void(SBTarget)>> m_fetch_modules_measurement;
-    Measurement<lldb::perf::TimeGauge, std::function<void(SBProcess,int)>> m_fetch_vars_measurement;
-    Measurement<lldb::perf::TimeGauge, std::function<void(SBFrame,const char*)>> m_run_expr_measurement;
+    Measurement<lldb_perf::TimeGauge, std::function<void(SBProcess)>> m_fetch_frames_measurement;
+    Measurement<lldb_perf::TimeGauge, std::function<void(SBTarget, const char*, uint32_t)>> m_file_line_bp_measurement;
+    Measurement<lldb_perf::TimeGauge, std::function<void(SBTarget)>> m_fetch_modules_measurement;
+    Measurement<lldb_perf::TimeGauge, std::function<void(SBProcess,int)>> m_fetch_vars_measurement;
+    Measurement<lldb_perf::TimeGauge, std::function<void(SBFrame,const char*)>> m_run_expr_measurement;
     
     SBThread
 	SelectMyThread (const char* file_name)

Modified: lldb/trunk/tools/lldb-perf/lib/Gauge.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Gauge.h?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Gauge.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/Gauge.h Mon Mar 18 17:34:00 2013
@@ -11,7 +11,7 @@
 
 #include <functional>
 
-namespace lldb { namespace perf
+namespace lldb_perf
 {
 template <class TASizeType>
 class Gauge
@@ -45,6 +45,6 @@ public:
     }
 
 };
-} }
+}
 
 #endif

Modified: lldb/trunk/tools/lldb-perf/lib/Measurement.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Measurement.h?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Measurement.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/Measurement.h Mon Mar 18 17:34:00 2013
@@ -13,7 +13,7 @@
 #include "Timer.h"
 #include "Metric.h"
 
-namespace lldb { namespace perf
+namespace lldb_perf
 {
 template <typename GaugeType, typename Action>
 class Measurement : public WriteToPList
@@ -90,6 +90,6 @@ public:
     }
 };
 
-} }
+}
 
 #endif /* defined(__PerfTestDriver__Measurement__) */

Modified: lldb/trunk/tools/lldb-perf/lib/MemoryGauge.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/MemoryGauge.cpp?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/MemoryGauge.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/MemoryGauge.cpp Mon Mar 18 17:34:00 2013
@@ -10,7 +10,7 @@
 #include <assert.h>
 #include <mach/task.h>
 
-using namespace lldb::perf;
+using namespace lldb_perf;
 
 MemoryGauge::SizeType
 MemoryGauge::now ()

Modified: lldb/trunk/tools/lldb-perf/lib/MemoryGauge.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/MemoryGauge.h?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/MemoryGauge.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/MemoryGauge.h Mon Mar 18 17:34:00 2013
@@ -13,7 +13,7 @@
 
 #include <mach/task_info.h>
 
-namespace lldb { namespace perf
+namespace lldb_perf
 {
 class MemoryGauge : public Gauge<mach_vm_size_t>
 {
@@ -48,6 +48,6 @@ public:
     SizeType
     value ();
 };
-} }
+}
 
 #endif /* defined(__PerfTestDriver__MemoryGauge__) */

Modified: lldb/trunk/tools/lldb-perf/lib/Metric.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Metric.cpp?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Metric.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/Metric.cpp Mon Mar 18 17:34:00 2013
@@ -12,7 +12,7 @@
 #include "CFCMutableDictionary.h"
 #include "CFCString.h"
 
-using namespace lldb::perf;
+using namespace lldb_perf;
 
 template <class T>
 Metric<T>::Metric () : Metric ("")
@@ -90,5 +90,5 @@ void Metric<T>::WriteImpl (CFCMutableArr
     parent.AppendValue(dict.get(), true);
 }
 
-template class lldb::perf::Metric<double>;
-template class lldb::perf::Metric<mach_vm_size_t>;
+template class lldb_perf::Metric<double>;
+template class lldb_perf::Metric<mach_vm_size_t>;

Modified: lldb/trunk/tools/lldb-perf/lib/Metric.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Metric.h?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Metric.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/Metric.h Mon Mar 18 17:34:00 2013
@@ -15,7 +15,7 @@
 
 #include "CFCMutableArray.h"
 
-namespace lldb { namespace perf
+namespace lldb_perf
 {
 class WriteToPList
 {
@@ -70,6 +70,6 @@ private:
     std::string m_description;
     std::vector<ValueType> m_dataset;
 };
-} }
+}
 
 #endif /* defined(__PerfTestDriver__Metric__) */

Modified: lldb/trunk/tools/lldb-perf/lib/TestCase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/TestCase.cpp?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/TestCase.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/TestCase.cpp Mon Mar 18 17:34:00 2013
@@ -9,7 +9,7 @@
 #include "TestCase.h"
 #include "Xcode.h"
 
-using namespace lldb::perf;
+using namespace lldb_perf;
 
 TestCase::TestCase () :
 m_debugger(),
@@ -131,14 +131,15 @@ TestCase::Loop ()
 				}
 				if (m_verbose)
 					printf("RUNNING STEP %d\n",step);
-				auto action = TestStep(step);
+                ActionWanted action;
+				TestStep(step, action);
 				step++;
 				switch (action.type)
 				{
-					case ActionWanted::Type::eAWContinue:
+					case ActionWanted::Type::eContinue:
 						m_debugger.HandleCommand("continue");
 						break;
-                    case ActionWanted::Type::eAWFinish:
+                    case ActionWanted::Type::eFinish:
                         if (action.thread.IsValid() == false)
                         {
                             if (m_verbose) Xcode::RunCommand(m_debugger,"bt all",true);
@@ -148,7 +149,7 @@ TestCase::Loop ()
                         m_process.SetSelectedThread(action.thread);
                         m_debugger.HandleCommand("finish");
 						break;
-					case ActionWanted::Type::eAWNext:
+					case ActionWanted::Type::eNext:
                         if (action.thread.IsValid() == false)
                         {
                             if (m_verbose) Xcode::RunCommand(m_debugger,"bt all",true);
@@ -158,7 +159,7 @@ TestCase::Loop ()
                         m_process.SetSelectedThread(action.thread);
                         m_debugger.HandleCommand("next");
 						break;
-					case ActionWanted::Type::eAWKill:
+					case ActionWanted::Type::eKill:
 						if (m_verbose) printf("I want to die\n");
 						m_process.Kill();
 						return;

Modified: lldb/trunk/tools/lldb-perf/lib/TestCase.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/TestCase.h?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/TestCase.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/TestCase.h Mon Mar 18 17:34:00 2013
@@ -12,9 +12,7 @@
 #include "lldb/API/LLDB.h"
 #include "Measurement.h"
 
-using namespace lldb;
-
-namespace lldb { namespace perf
+namespace lldb_perf
 {
 class TestCase
 {
@@ -25,12 +23,46 @@ public:
 	{
 		enum class Type
 		{
-			eAWNext,
-			eAWContinue,
-            eAWFinish,
-			eAWKill
+			eNext,
+			eContinue,
+            eFinish,
+			eKill
 		} type;
-		SBThread thread;
+		lldb::SBThread thread;
+        
+        ActionWanted () :
+            type (Type::eContinue),
+            thread ()
+        {
+        }
+        
+        void
+        Continue()
+        {
+            type = Type::eContinue;
+            thread = lldb::SBThread();
+        }
+        
+        void
+        Next (lldb::SBThread t)
+        {
+            type = Type::eNext;
+            thread = t;
+        }
+
+        void
+        Finish (lldb::SBThread t)
+        {
+            type = Type::eFinish;
+            thread = t;
+        }
+        
+        void
+        Kill ()
+        {
+            type = Type::eKill;
+            thread = lldb::SBThread();
+        }
 	};
     
     virtual
@@ -40,8 +72,8 @@ public:
 	virtual void
 	Setup (int argc, const char** argv);
     
-	virtual ActionWanted
-	TestStep (int counter) = 0;
+	virtual void
+	TestStep (int counter, ActionWanted &next_action) = 0;
 	
 	bool
 	Launch (const char** args, const char* cwd);
@@ -74,13 +106,13 @@ public:
     Run (TestCase& test, int argc, const char** argv);
     
 protected:
-	SBDebugger m_debugger;
-	SBTarget m_target;
-	SBProcess m_process;
-	SBThread m_thread;
-	SBListener m_listener;
+    lldb::SBDebugger m_debugger;
+	lldb::SBTarget m_target;
+	lldb::SBProcess m_process;
+	lldb::SBThread m_thread;
+	lldb::SBListener m_listener;
     bool m_verbose;
 };
-} }
+}
 
 #endif /* defined(__PerfTestDriver__TestCase__) */

Modified: lldb/trunk/tools/lldb-perf/lib/Timer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Timer.cpp?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Timer.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/Timer.cpp Mon Mar 18 17:34:00 2013
@@ -9,7 +9,7 @@
 #include "Timer.h"
 #include <assert.h>
 
-using namespace lldb::perf;
+using namespace lldb_perf;
 
 TimeGauge::HPTime
 TimeGauge::now ()

Modified: lldb/trunk/tools/lldb-perf/lib/Timer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Timer.h?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Timer.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/Timer.h Mon Mar 18 17:34:00 2013
@@ -15,7 +15,7 @@
 
 using namespace std::chrono;
 
-namespace lldb { namespace perf
+namespace lldb_perf
 {
 class TimeGauge : public Gauge<double>
 {
@@ -51,6 +51,6 @@ public:
     double
     value ();
 };
-} }
+}
 
 #endif /* defined(__PerfTestDriver__Timer__) */

Modified: lldb/trunk/tools/lldb-perf/lib/Xcode.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Xcode.cpp?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Xcode.cpp (original)
+++ lldb/trunk/tools/lldb-perf/lib/Xcode.cpp Mon Mar 18 17:34:00 2013
@@ -10,7 +10,7 @@
 #include <string>
 
 using namespace std;
-using namespace lldb::perf;
+using namespace lldb_perf;
 
 void
 Xcode::FetchVariable (SBValue value, uint32_t expand, bool verbose)

Modified: lldb/trunk/tools/lldb-perf/lib/Xcode.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-perf/lib/Xcode.h?rev=177332&r1=177331&r2=177332&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-perf/lib/Xcode.h (original)
+++ lldb/trunk/tools/lldb-perf/lib/Xcode.h Mon Mar 18 17:34:00 2013
@@ -23,7 +23,7 @@
 
 using namespace lldb;
 
-namespace lldb { namespace perf
+namespace lldb_perf
 {
 class Xcode
 {
@@ -58,6 +58,6 @@ public:
     static SBBreakpoint
     CreateFileLineBreakpoint (SBTarget target, const char* file, uint32_t line);
 };
-} }
+}
 
 #endif /* defined(__PerfTestDriver__Xcode__) */





More information about the lldb-commits mailing list