mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
Pass ConstString by value (NFC)
My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
OptionValueProperties::OptionValueProperties(const ConstString &name)
|
||||
OptionValueProperties::OptionValueProperties(ConstString name)
|
||||
: OptionValue(), m_name(name), m_properties(), m_name_to_index() {}
|
||||
|
||||
OptionValueProperties::OptionValueProperties(
|
||||
@@ -66,8 +66,8 @@ void OptionValueProperties::SetValueChangedCallback(
|
||||
property->SetValueChangedCallback(callback, baton);
|
||||
}
|
||||
|
||||
void OptionValueProperties::AppendProperty(const ConstString &name,
|
||||
const ConstString &desc,
|
||||
void OptionValueProperties::AppendProperty(ConstString name,
|
||||
ConstString desc,
|
||||
bool is_global,
|
||||
const OptionValueSP &value_sp) {
|
||||
Property property(name, desc, is_global, value_sp);
|
||||
@@ -98,7 +98,7 @@ void OptionValueProperties::AppendProperty(const ConstString &name,
|
||||
//
|
||||
lldb::OptionValueSP
|
||||
OptionValueProperties::GetValueForKey(const ExecutionContext *exe_ctx,
|
||||
const ConstString &key,
|
||||
ConstString key,
|
||||
bool will_modify) const {
|
||||
lldb::OptionValueSP value_sp;
|
||||
size_t idx = m_name_to_index.Find(key, SIZE_MAX);
|
||||
@@ -219,14 +219,14 @@ Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
OptionValueProperties::GetPropertyIndex(const ConstString &name) const {
|
||||
OptionValueProperties::GetPropertyIndex(ConstString name) const {
|
||||
return m_name_to_index.Find(name, SIZE_MAX);
|
||||
}
|
||||
|
||||
const Property *
|
||||
OptionValueProperties::GetProperty(const ExecutionContext *exe_ctx,
|
||||
bool will_modify,
|
||||
const ConstString &name) const {
|
||||
ConstString name) const {
|
||||
return GetPropertyAtIndex(
|
||||
exe_ctx, will_modify,
|
||||
m_name_to_index.Find(name, SIZE_MAX));
|
||||
@@ -667,7 +667,7 @@ void OptionValueProperties::Apropos(
|
||||
|
||||
lldb::OptionValuePropertiesSP
|
||||
OptionValueProperties::GetSubProperty(const ExecutionContext *exe_ctx,
|
||||
const ConstString &name) {
|
||||
ConstString name) {
|
||||
lldb::OptionValueSP option_value_sp(GetValueForKey(exe_ctx, name, false));
|
||||
if (option_value_sp) {
|
||||
OptionValueProperties *ov_properties = option_value_sp->GetAsProperties();
|
||||
|
||||
Reference in New Issue
Block a user