diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/tools/lldb-perf/lib/TestCase.h | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/tools/lldb-perf/lib/TestCase.h')
-rw-r--r-- | lldb/tools/lldb-perf/lib/TestCase.h | 286 |
1 files changed, 113 insertions, 173 deletions
diff --git a/lldb/tools/lldb-perf/lib/TestCase.h b/lldb/tools/lldb-perf/lib/TestCase.h index 811d0432b58..8ec1a47d7b4 100644 --- a/lldb/tools/lldb-perf/lib/TestCase.h +++ b/lldb/tools/lldb-perf/lib/TestCase.h @@ -10,195 +10,135 @@ #ifndef __PerfTestDriver__TestCase__ #define __PerfTestDriver__TestCase__ -#include "lldb/API/LLDB.h" #include "Measurement.h" +#include "lldb/API/LLDB.h" #include <getopt.h> namespace lldb_perf { class Results; - -class TestCase -{ + +class TestCase { public: - TestCase(); - - struct ActionWanted - { - enum class Type - { - eStepOver, - eContinue, - eStepOut, - eRelaunch, - eCallNext, - eNone, - eKill - } type; - lldb::SBThread thread; - lldb::SBLaunchInfo launch_info; - - ActionWanted () : - type (Type::eContinue), - thread (), - launch_info (NULL) - { - } - - void - None () - { - type = Type::eNone; - thread = lldb::SBThread(); - } - - void - Continue() - { - type = Type::eContinue; - thread = lldb::SBThread(); - } - - void - StepOver (lldb::SBThread t) - { - type = Type::eStepOver; - thread = t; - } - - void - StepOut (lldb::SBThread t) - { - type = Type::eStepOut; - thread = t; - } - - void - Relaunch (lldb::SBLaunchInfo l) - { - type = Type::eRelaunch; - thread = lldb::SBThread(); - launch_info = l; - } - - void - Kill () - { - type = Type::eKill; - thread = lldb::SBThread(); - } - - void - CallNext () - { - type = Type::eCallNext; - thread = lldb::SBThread(); - } - }; - - virtual - ~TestCase () - { - } - - virtual bool - Setup (int& argc, const char**& argv); - - virtual void - TestStep (int counter, ActionWanted &next_action) = 0; - - bool - Launch (lldb::SBLaunchInfo &launch_info); - - bool - Launch (std::initializer_list<const char*> args = {}); - - void - Loop(); - - void - SetVerbose (bool); - - bool - GetVerbose (); - - virtual void - WriteResults (Results &results) = 0; - - template <typename G,typename A> - Measurement<G,A> CreateMeasurement (A a, const char* name = NULL, const char* description = NULL) - { - return Measurement<G,A> (a,name, description); - } - - template <typename A> - TimeMeasurement<A> CreateTimeMeasurement (A a, const char* name = NULL, const char* description = NULL) - { - return TimeMeasurement<A> (a,name, description); - } - - template <typename A> - MemoryMeasurement<A> CreateMemoryMeasurement (A a, const char* name = NULL, const char* description = NULL) - { - return MemoryMeasurement<A> (a,name, description); - } - - static int - Run (TestCase& test, int argc, const char** argv); - - virtual bool - ParseOption (int short_option, const char* optarg) - { - return false; + TestCase(); + + struct ActionWanted { + enum class Type { + eStepOver, + eContinue, + eStepOut, + eRelaunch, + eCallNext, + eNone, + eKill + } type; + lldb::SBThread thread; + lldb::SBLaunchInfo launch_info; + + ActionWanted() : type(Type::eContinue), thread(), launch_info(NULL) {} + + void None() { + type = Type::eNone; + thread = lldb::SBThread(); } - - virtual struct option* - GetLongOptions () - { - return NULL; + + void Continue() { + type = Type::eContinue; + thread = lldb::SBThread(); } - - lldb::SBDebugger & - GetDebugger() - { - return m_debugger; + + void StepOver(lldb::SBThread t) { + type = Type::eStepOver; + thread = t; } - lldb::SBTarget & - GetTarget() - { - return m_target; + void StepOut(lldb::SBThread t) { + type = Type::eStepOut; + thread = t; } - - lldb::SBProcess & - GetProcess () - { - return m_process; + + void Relaunch(lldb::SBLaunchInfo l) { + type = Type::eRelaunch; + thread = lldb::SBThread(); + launch_info = l; } - - lldb::SBThread & - GetThread () - { - return m_thread; + + void Kill() { + type = Type::eKill; + thread = lldb::SBThread(); } - - int - GetStep () - { - return m_step; + + void CallNext() { + type = Type::eCallNext; + thread = lldb::SBThread(); } - - static const int RUN_SUCCESS = 0; - static const int RUN_SETUP_ERROR = 100; - + }; + + virtual ~TestCase() {} + + virtual bool Setup(int &argc, const char **&argv); + + virtual void TestStep(int counter, ActionWanted &next_action) = 0; + + bool Launch(lldb::SBLaunchInfo &launch_info); + + bool Launch(std::initializer_list<const char *> args = {}); + + void Loop(); + + void SetVerbose(bool); + + bool GetVerbose(); + + virtual void WriteResults(Results &results) = 0; + + template <typename G, typename A> + Measurement<G, A> CreateMeasurement(A a, const char *name = NULL, + const char *description = NULL) { + return Measurement<G, A>(a, name, description); + } + + template <typename A> + TimeMeasurement<A> CreateTimeMeasurement(A a, const char *name = NULL, + const char *description = NULL) { + return TimeMeasurement<A>(a, name, description); + } + + template <typename A> + MemoryMeasurement<A> CreateMemoryMeasurement(A a, const char *name = NULL, + const char *description = NULL) { + return MemoryMeasurement<A>(a, name, description); + } + + static int Run(TestCase &test, int argc, const char **argv); + + virtual bool ParseOption(int short_option, const char *optarg) { + return false; + } + + virtual struct option *GetLongOptions() { return NULL; } + + lldb::SBDebugger &GetDebugger() { return m_debugger; } + + lldb::SBTarget &GetTarget() { return m_target; } + + lldb::SBProcess &GetProcess() { return m_process; } + + lldb::SBThread &GetThread() { return m_thread; } + + int GetStep() { return m_step; } + + static const int RUN_SUCCESS = 0; + static const int RUN_SETUP_ERROR = 100; + protected: - lldb::SBDebugger m_debugger; - lldb::SBTarget m_target; - lldb::SBProcess m_process; - lldb::SBThread m_thread; - lldb::SBListener m_listener; - bool m_verbose; - int m_step; + lldb::SBDebugger m_debugger; + lldb::SBTarget m_target; + lldb::SBProcess m_process; + lldb::SBThread m_thread; + lldb::SBListener m_listener; + bool m_verbose; + int m_step; }; } |