Make GetInstanceSettingsValue methods take an Error * rather than an Error &,

and have them return a bool to indicate success or not.

llvm-svn: 114361
This commit is contained in:
Caroline Tice 2010-09-20 21:37:42 +00:00
parent db5c09a8cd
commit 12cecd741d
10 changed files with 46 additions and 34 deletions

View File

@ -60,11 +60,11 @@ public:
Error &err,
bool pending);
void
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err);
Error *err);
uint32_t
GetTerminalWidth () const

View File

@ -370,11 +370,11 @@ public:
Error &err,
bool pending) = 0;
virtual void
virtual bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err) = 0;
Error *err) = 0;
virtual void
CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,

View File

@ -69,11 +69,11 @@ public:
Error &err,
bool pending);
void
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err);
Error *err);
const Args &

View File

@ -56,11 +56,11 @@ public:
Error &err,
bool pending);
void
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err);
Error *err);
protected:

View File

@ -50,11 +50,11 @@ public:
Error &err,
bool pending);
void
bool
GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err);
Error *err);
RegularExpression *
GetSymbolsToAvoidRegexp()

View File

@ -1375,11 +1375,11 @@ DebuggerInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var
}
}
void
bool
DebuggerInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err)
Error *err)
{
if (var_name == PromptVarName())
{
@ -1404,7 +1404,12 @@ DebuggerInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
value.AppendString ("false");
}
else
err.SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
{
if (err)
err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
return false;
}
return true;
}
void

View File

@ -562,7 +562,7 @@ UserSettingsController::GetVariable
if (current_settings != NULL)
{
current_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, err);
current_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err);
}
else
{
@ -575,14 +575,14 @@ UserSettingsController::GetVariable
if (pos != m_pending_settings.end())
{
lldb::InstanceSettingsSP settings_sp = pos->second;
settings_sp->GetInstanceSettingsValue (*instance_entry, const_var_name, value, err);
settings_sp->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err);
}
else
{
if (m_settings.level_name.GetLength() > 0)
{
// No valid instance name; assume they want the default settings.
m_default_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, err);
m_default_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err);
}
else
{
@ -595,7 +595,7 @@ UserSettingsController::GetVariable
ConstString dbg_name (debugger_instance_name);
InstanceSettings *dbg_settings = FindSettingsForInstance (dbg_name);
if (dbg_settings)
dbg_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, err);
dbg_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err);
}
}
}
@ -621,7 +621,7 @@ UserSettingsController::GetVariable
{
var_type = instance_entry->var_type;
if (m_settings.level_name.GetLength() > 0)
m_default_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, err);
m_default_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err);
else
{
// We're at the Debugger level; use the debugger's instance settings.
@ -633,7 +633,7 @@ UserSettingsController::GetVariable
ConstString dbg_name (tmp_name.GetData());
InstanceSettings *dbg_settings = FindSettingsForInstance (dbg_name);
if (dbg_settings)
dbg_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, err);
dbg_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err);
}
}
}
@ -716,7 +716,7 @@ UserSettingsController::CopyDefaultSettings (const lldb::InstanceSettingsSP &act
SettingEntry &entry = m_settings.instance_settings[i];
ConstString var_name (entry.var_name);
StringList value;
m_default_settings->GetInstanceSettingsValue (entry, var_name, value, err);
m_default_settings->GetInstanceSettingsValue (entry, var_name, value, NULL);
std::string value_str;
if (value.GetSize() == 1)
@ -777,8 +777,7 @@ UserSettingsController::GetAllDefaultSettingValues (StreamString &result_stream)
SettingEntry &entry = m_settings.instance_settings[i];
ConstString var_name (entry.var_name);
StringList tmp_value;
Error err;
m_default_settings->GetInstanceSettingsValue (entry, var_name, tmp_value, err);
m_default_settings->GetInstanceSettingsValue (entry, var_name, tmp_value, NULL);
StreamString value_string;
@ -817,8 +816,7 @@ UserSettingsController::GetAllPendingSettingValues (StreamString &result_stream)
SettingEntry &entry = m_settings.instance_settings[i];
ConstString var_name (entry.var_name);
StringList tmp_value;
Error err;
settings_sp->GetInstanceSettingsValue (entry, var_name, tmp_value, err);
settings_sp->GetInstanceSettingsValue (entry, var_name, tmp_value, NULL);
StreamString value_str;
@ -884,8 +882,7 @@ UserSettingsController::GetAllInstanceVariableValues (CommandInterpreter &interp
SettingEntry &entry = m_settings.instance_settings[i];
const ConstString var_name (entry.var_name);
StringList tmp_value;
Error err;
settings->GetInstanceSettingsValue (entry, var_name, tmp_value, err);
settings->GetInstanceSettingsValue (entry, var_name, tmp_value, NULL);
StreamString tmp_value_str;
if (tmp_value.GetSize() == 0)

View File

@ -1988,11 +1988,11 @@ ProcessInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &n
m_disable_aslr = new_process_settings->m_disable_aslr;
}
void
bool
ProcessInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err)
Error *err)
{
if (var_name == RunArgsVarName())
{
@ -2039,7 +2039,12 @@ ProcessInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
value.AppendString ("false");
}
else
err.SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
{
if (err)
err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
return false;
}
return true;
}
const ConstString

View File

@ -934,11 +934,11 @@ TargetInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &ne
// Currently 'target' does not have any instance settings.
}
void
bool
TargetInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err)
Error *err)
{
// Currently 'target' does not have any instance settings.
}

View File

@ -1062,11 +1062,11 @@ ThreadInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &ne
m_avoid_regexp_ap.reset ();
}
void
bool
ThreadInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value,
Error &err)
Error *err)
{
if (var_name == StepAvoidRegexpVarName())
{
@ -1080,7 +1080,12 @@ ThreadInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
}
else
err.SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
{
if (err)
err->SetErrorStringWithFormat ("unrecognized variable name '%s'", var_name.AsCString());
return false;
}
return true;
}
const ConstString