From 70539360e6a743edd257889c00e7856ec3101d0d Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Mon, 16 Apr 2018 18:25:57 +0000 Subject: [PATCH] [Statistics] Move GetStatDescription to an header file. In preparation for using it in the API. llvm-svn: 330147 --- lldb/include/lldb/lldb-private-enumerations.h | 17 +++++++++++++++++ lldb/source/Commands/CommandObjectStats.cpp | 19 +------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lldb/include/lldb/lldb-private-enumerations.h b/lldb/include/lldb/lldb-private-enumerations.h index 38ac819..94dc84a 100644 --- a/lldb/include/lldb/lldb-private-enumerations.h +++ b/lldb/include/lldb/lldb-private-enumerations.h @@ -246,6 +246,23 @@ enum StatisticKind { StatisticMax = 4 }; + +std::string GetStatDescription(lldb_private::StatisticKind K) { + switch (K) { + case StatisticKind::ExpressionSuccessful: + return "Number of expr evaluation successes"; + case StatisticKind::ExpressionFailure: + return "Number of expr evaluation failures"; + case StatisticKind::FrameVarSuccess: + return "Number of frame var successes"; + case StatisticKind::FrameVarFailure: + return "Number of frame var failures"; + case StatisticKind::StatisticMax: + return ""; + } + llvm_unreachable("Statistic not registered!"); +} + } // namespace lldb_private namespace llvm { diff --git a/lldb/source/Commands/CommandObjectStats.cpp b/lldb/source/Commands/CommandObjectStats.cpp index 3d3eb48..9225a94 100644 --- a/lldb/source/Commands/CommandObjectStats.cpp +++ b/lldb/source/Commands/CommandObjectStats.cpp @@ -67,23 +67,6 @@ protected: }; class CommandObjectStatsDump : public CommandObjectParsed { -private: - std::string GetStatDescription(lldb_private::StatisticKind K) { - switch (K) { - case StatisticKind::ExpressionSuccessful: - return "Number of expr evaluation successes"; - case StatisticKind::ExpressionFailure: - return "Number of expr evaluation failures"; - case StatisticKind::FrameVarSuccess: - return "Number of frame var successes"; - case StatisticKind::FrameVarFailure: - return "Number of frame var failures"; - case StatisticKind::StatisticMax: - return ""; - } - llvm_unreachable("Statistic not registered!"); - } - public: CommandObjectStatsDump(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "dump", "Dump statistics results", @@ -99,7 +82,7 @@ protected: for (auto &stat : target->GetStatistics()) { result.AppendMessageWithFormat( "%s : %u\n", - GetStatDescription(static_cast(i)) + lldb_private::GetStatDescription(static_cast(i)) .c_str(), stat); i += 1; -- 2.7.4