The `ap` suffix is a remnant of lldb's former use of auto pointers, before they got deprecated. Although all their uses were replaced by unique pointers, some variables still carried the suffix. In r353795 I removed another auto_ptr remnant, namely redundant calls to ::get for unique_pointers. Jim justly noted that this is a good opportunity to clean up the variable names as well. I went over all the changes to ensure my find-and-replace didn't have any undesired side-effects. I hope I didn't miss any, but if you end up at this commit doing a git blame on a weirdly named variable, please know that the change was unintentional. llvm-svn: 353912
50 lines
2.0 KiB
C++
50 lines
2.0 KiB
C++
//===-- Gauge.cpp -----------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "Gauge.h"
|
|
#include "lldb/lldb-forward.h"
|
|
|
|
template <>
|
|
lldb_perf::Results::ResultSP lldb_perf::GetResult(const char *description,
|
|
double value) {
|
|
if (description && description[0]) {
|
|
std::unique_ptr<Results::Dictionary> value_dict_up(
|
|
new Results::Dictionary());
|
|
value_dict_up->AddString("description", NULL, description);
|
|
value_dict_up->AddDouble("value", NULL, value);
|
|
return Results::ResultSP(value_dict_up.release());
|
|
}
|
|
return Results::ResultSP(new Results::Double(NULL, NULL, value));
|
|
}
|
|
|
|
template <>
|
|
lldb_perf::Results::ResultSP lldb_perf::GetResult(const char *description,
|
|
uint64_t value) {
|
|
if (description && description[0]) {
|
|
std::unique_ptr<Results::Dictionary> value_dict_up(
|
|
new Results::Dictionary());
|
|
value_dict_up->AddString("description", NULL, description);
|
|
value_dict_up->AddUnsigned("value", NULL, value);
|
|
return Results::ResultSP(value_dict_up.release());
|
|
}
|
|
return Results::ResultSP(new Results::Unsigned(NULL, NULL, value));
|
|
}
|
|
|
|
template <>
|
|
lldb_perf::Results::ResultSP lldb_perf::GetResult(const char *description,
|
|
std::string value) {
|
|
if (description && description[0]) {
|
|
std::unique_ptr<Results::Dictionary> value_dict_up(
|
|
new Results::Dictionary());
|
|
value_dict_up->AddString("description", NULL, description);
|
|
value_dict_up->AddString("value", NULL, value.c_str());
|
|
return Results::ResultSP(value_dict_up.release());
|
|
}
|
|
return Results::ResultSP(new Results::String(NULL, NULL, value.c_str()));
|
|
}
|