adding a summary for Objective-C type 'Class'

llvm-svn: 153541
This commit is contained in:
Enrico Granata 2012-03-27 21:49:20 +00:00
parent f216c7df2b
commit bf70ee97b1
6 changed files with 42 additions and 1 deletions

View File

@ -593,6 +593,12 @@ class ObjCRuntime:
return 1
return 2
@staticmethod
def runtime_from_isa(isa):
runtime = ObjCRuntime(isa)
runtime.isa = isa
return runtime
def __init__(self,valobj):
self.valobj = valobj
self.adjust_for_architecture()

View File

@ -452,6 +452,20 @@ else
fi
fi
if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Class.py" ]
then
if [ $Debug == 1 ]
then
echo "Copying Class.py to ${framework_python_dir}"
fi
cp "${SRC_ROOT}/examples/summaries/cocoa/Class.py" "${framework_python_dir}"
else
if [ $Debug == 1 ]
then
echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Class.py"
fi
fi
if [ -f "${SRC_ROOT}/examples/summaries/cocoa/cache.py" ]
then
if [ $Debug == 1 ]

View File

@ -796,6 +796,7 @@ FormatManager::LoadObjCFormatters()
AddScriptSummary(objc_category_sp, "Selector.SEL_Summary", ConstString("struct objc_selector"), objc_flags);
AddScriptSummary(objc_category_sp, "Selector.SEL_Summary", ConstString("objc_selector"), objc_flags);
AddScriptSummary(objc_category_sp, "Selector.SELPointer_Summary", ConstString("objc_selector *"), objc_flags);
AddScriptSummary(objc_category_sp, "Class.Class_Summary", ConstString("Class"), objc_flags);
objc_flags.SetSkipPointers(false);
TypeCategoryImpl::SharedPointer corefoundation_category_sp = GetCategory(m_corefoundation_category_name);

View File

@ -303,7 +303,7 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
// WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set
// and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task
run_string.Clear();
run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate, NSIndexSet, Selector, CFBitVector')", m_dictionary_name.c_str());
run_string.Printf ("run_one_line (%s, 'import CFString, CFArray, CFDictionary, NSData, NSMachPort, NSSet, NSNotification, NSException, CFBag, CFBinaryHeap, NSURL, NSBundle, NSNumber, NSDate, NSIndexSet, Selector, Class, CFBitVector')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
int new_count = Debugger::TestDebuggerRefCount();

View File

@ -297,6 +297,20 @@ class ObjCDataFormatterTestCase(TestBase):
'@"Europe/Paris"'])
self.runCmd('type category list')
self.runCmd('type summary list')
self.expect('frame variable myclass',
substrs = ['(Class) myclass = NSValue'])
self.expect('frame variable myclass2',
substrs = ['(Class) myclass2 = __NSCFConstantString'])
self.expect('frame variable myclass3',
substrs = ['(Class) myclass3 = Molecule'])
self.expect('frame variable myclass4',
substrs = ['(Class) myclass4 = NSMutableArray'])
self.expect('frame variable myclass5',
substrs = ['(Class) myclass5 = <error: unknown Class>'])
def expr_objc_data_formatter_commands(self):
"""Test common cases of expression parser <--> formatters interaction."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)

View File

@ -631,6 +631,12 @@ int main (int argc, const char * argv[])
Molecule *molecule = [Molecule new];
Class myclass = NSClassFromString(@"NSValue");
Class myclass2 = [str0 class];
Class myclass3 = [molecule class];
Class myclass4 = NSClassFromString(@"NSMutableArray");
Class myclass5 = [nil class];
// Set break point at this line.
[molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL];