forked from OSchip/llvm-project
This commit provides a new default summary for Objective-C boolean variables, which shows YES or NO instead of the character value. A new category named objc is added to contain this summary provider. Any future Objective-C related formatters would probably fit here
llvm-svn: 149388
This commit is contained in:
parent
27a59958bd
commit
bac45f610d
|
@ -0,0 +1,9 @@
|
|||
# Summaries for common ObjC types that require Python scripting
|
||||
# to be generated fit into this file
|
||||
|
||||
def BOOL_SummaryProvider (valobj,dict):
|
||||
if valobj.GetValueAsUnsigned() == 0:
|
||||
return "NO"
|
||||
else:
|
||||
return "YES"
|
||||
|
|
@ -508,6 +508,7 @@ private:
|
|||
ConstString m_default_category_name;
|
||||
ConstString m_system_category_name;
|
||||
ConstString m_gnu_cpp_category_name;
|
||||
ConstString m_objc_category_name;
|
||||
|
||||
CategoryMap&
|
||||
GetCategories ()
|
||||
|
|
|
@ -184,6 +184,21 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
# Copy the ObjC formatters over to the framework Python directory
|
||||
if [ -f "${SRC_ROOT}/examples/synthetic/objc.py" ]
|
||||
then
|
||||
if [ $Debug == 1 ]
|
||||
then
|
||||
echo "Copying objc.py to ${framework_python_dir}"
|
||||
fi
|
||||
cp "${SRC_ROOT}/examples/summaries/objc.py" "${framework_python_dir}"
|
||||
else
|
||||
if [ $Debug == 1 ]
|
||||
then
|
||||
echo "Unable to find ${SRC_ROOT}/examples/summaries/objc.py"
|
||||
fi
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -560,7 +560,8 @@ FormatManager::FormatManager() :
|
|||
m_categories_map(this),
|
||||
m_default_category_name(ConstString("default")),
|
||||
m_system_category_name(ConstString("system")),
|
||||
m_gnu_cpp_category_name(ConstString("gnu-libstdc++"))
|
||||
m_gnu_cpp_category_name(ConstString("gnu-libstdc++")),
|
||||
m_objc_category_name(ConstString("objc"))
|
||||
{
|
||||
|
||||
// add some default stuff
|
||||
|
@ -584,7 +585,6 @@ FormatManager::FormatManager() :
|
|||
|
||||
lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
|
||||
|
||||
|
||||
FormatCategory::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
|
||||
|
||||
sys_category_sp->GetSummaryNavigator()->Add(ConstString("char *"), string_format);
|
||||
|
@ -633,9 +633,23 @@ FormatManager::FormatManager() :
|
|||
false,
|
||||
false,
|
||||
"gnu_libstdcpp.StdListSynthProvider")));
|
||||
|
||||
lldb::SummaryFormatSP ObjC_BOOL_summary(new ScriptSummaryFormat(false,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
"objc.BOOL_SummaryProvider",
|
||||
""));
|
||||
FormatCategory::SharedPointer objc_category_sp = GetCategory(m_objc_category_name);
|
||||
objc_category_sp->GetSummaryNavigator()->Add(ConstString("BOOL"),
|
||||
ObjC_BOOL_summary);
|
||||
#endif
|
||||
|
||||
// DO NOT change the order of these calls, unless you WANT a change in the priority of these categories
|
||||
EnableCategory(m_system_category_name);
|
||||
EnableCategory(m_objc_category_name);
|
||||
EnableCategory(m_gnu_cpp_category_name);
|
||||
EnableCategory(m_default_category_name);
|
||||
|
||||
|
|
|
@ -247,6 +247,10 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
|
|||
run_string.Printf ("run_one_line (%s, 'import gnu_libstdcpp')", m_dictionary_name.c_str());
|
||||
PyRun_SimpleString (run_string.GetData());
|
||||
|
||||
run_string.Clear();
|
||||
run_string.Printf ("run_one_line (%s, 'import objc')", m_dictionary_name.c_str());
|
||||
PyRun_SimpleString (run_string.GetData());
|
||||
|
||||
if (m_dbg_stdout != NULL)
|
||||
{
|
||||
m_new_sysout = PyFile_FromFile (m_dbg_stdout, (char *) "", (char *) "w", _check_and_flush);
|
||||
|
|
Loading…
Reference in New Issue