<rdar://problem/10062621>

New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
 SBTypeCategory
 SBTypeFilter
 SBTypeFormat
 SBTypeSummary
 SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.

llvm-svn: 150558
This commit is contained in:
Enrico Granata
2012-02-15 02:34:21 +00:00
parent b228a86fcf
commit 061858ce61
44 changed files with 4423 additions and 492 deletions

View File

@@ -1140,7 +1140,7 @@ ScriptInterpreterPython::GenerateFunction(std::string& signature, StringList &in
// this implementation is identical to GenerateBreakpointCommandCallbackData (apart from the name
// given to generated functions, of course)
bool
ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, StringList &output)
ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, StringList &output, void* name_token)
{
static int num_created_functions = 0;
user_input.RemoveBlankLines ();
@@ -1154,7 +1154,10 @@ ScriptInterpreterPython::GenerateTypeScriptFunction (StringList &user_input, Str
// Take what the user wrote, wrap it all up inside one big auto-generated Python function, passing in the
// ValueObject as parameter to the function.
sstr.Printf ("lldb_autogen_python_type_print_func_%d", num_created_functions);
if (!name_token)
sstr.Printf ("lldb_autogen_python_type_print_func_%d", num_created_functions);
else
sstr.Printf ("lldb_gen_python_type_print_func_%p", name_token);
++num_created_functions;
std::string auto_generated_function_name = sstr.GetData();
@@ -1267,7 +1270,7 @@ ScriptInterpreterPython::GenerateScriptAliasFunction (StringList &user_input, St
bool
ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringList &output)
ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringList &output, void* name_token)
{
static int num_created_classes = 0;
user_input.RemoveBlankLines ();
@@ -1280,7 +1283,10 @@ ScriptInterpreterPython::GenerateTypeSynthClass (StringList &user_input, StringL
// Wrap all user input into a Python class
sstr.Printf ("lldb_autogen_python_type_synth_class_%d", num_created_classes);
if (!name_token)
sstr.Printf ("lldb_autogen_python_type_synth_class_%d", num_created_classes);
else
sstr.Printf ("lldb_gen_python_type_synth_class_%p", name_token);
++num_created_classes;
std::string auto_generated_class_name = sstr.GetData();
@@ -1349,12 +1355,22 @@ ScriptInterpreterPython::CreateSyntheticScriptedProvider (std::string class_name
}
bool
ScriptInterpreterPython::GenerateTypeScriptFunction (const char* oneliner, StringList &output)
ScriptInterpreterPython::GenerateTypeScriptFunction (const char* oneliner, StringList &output, void* name_token)
{
StringList input(oneliner);
return GenerateTypeScriptFunction(input, output);
StringList input;
input.SplitIntoLines(oneliner, strlen(oneliner));
return GenerateTypeScriptFunction(input, output, name_token);
}
bool
ScriptInterpreterPython::GenerateTypeSynthClass (const char* oneliner, StringList &output, void* name_token)
{
StringList input;
input.SplitIntoLines(oneliner, strlen(oneliner));
return GenerateTypeSynthClass(input, output, name_token);
}
bool
ScriptInterpreterPython::GenerateBreakpointCommandCallbackData (StringList &user_input, StringList &callback_data)
{
@@ -1775,12 +1791,12 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
return false;
}
// call __lldb_module_init(debugger,dict)
// call __lldb_init_module(debugger,dict)
if (!g_swig_call_module_init (basename,
m_dictionary_name.c_str(),
debugger_sp))
{
error.SetErrorString("calling __lldb_module_init failed");
error.SetErrorString("calling __lldb_init_module failed");
return false;
}
return true;