Author: davide Date: Mon Apr 16 11:25:57 2018 New Revision: 330147 URL: http://llvm.org/viewvc/llvm-project?rev=330147&view=rev Log: [Statistics] Move GetStatDescription to an header file.
In preparation for using it in the API. <rdar://problem/36555975> Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h lldb/trunk/source/Commands/CommandObjectStats.cpp Modified: lldb/trunk/include/lldb/lldb-private-enumerations.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-enumerations.h?rev=330147&r1=330146&r2=330147&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-enumerations.h (original) +++ lldb/trunk/include/lldb/lldb-private-enumerations.h Mon Apr 16 11:25:57 2018 @@ -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 { Modified: lldb/trunk/source/Commands/CommandObjectStats.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectStats.cpp?rev=330147&r1=330146&r2=330147&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectStats.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectStats.cpp Mon Apr 16 11:25:57 2018 @@ -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<lldb_private::StatisticKind>(i)) + lldb_private::GetStatDescription(static_cast<lldb_private::StatisticKind>(i)) .c_str(), stat); i += 1; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits