[Lldb-commits] [lldb] r136784 - in /lldb/trunk: source/Expression/ClangUserExpression.cpp test/lang/objc/objc-static-method/TestObjCStaticMethod.py test/lang/objc/objc-static-method/static.m
Sean Callanan
scallanan at apple.com
Wed Aug 3 09:23:08 PDT 2011
Author: spyffe
Date: Wed Aug 3 11:23:08 2011
New Revision: 136784
URL: http://llvm.org/viewvc/llvm-project?rev=136784&view=rev
Log:
Improved the expression parser's detection of the
current context. Previously, if there was a variable
called "self" available, the expression parser
assumed it was inside a method. But class methods
in Objective-C also take a "self" parameter, of DWARF
type "id". We now detect this properly, and only
assume we're in an instance method if "self" is a
pointer to an Objective-C object.
Modified:
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
lldb/trunk/test/lang/objc/objc-static-method/static.m
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=136784&r1=136783&r2=136784&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Aug 3 11:23:08 2011
@@ -68,9 +68,6 @@
void
ClangUserExpression::ScanContext(ExecutionContext &exe_ctx)
{
- if (!exe_ctx.frame)
- return;
-
VariableList *vars = exe_ctx.frame->GetVariableList(false);
if (!vars)
@@ -102,6 +99,13 @@
else if (self_var.get())
{
m_objectivec = true;
+
+ Type *self_type = self_var->GetType();
+
+ if (self_type->GetClangForwardType() == self_type->GetClangASTContext().GetBuiltInType_objc_id())
+ {
+ m_objectivec = false;
+ }
}
}
Modified: lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py?rev=136784&r1=136783&r2=136784&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py (original)
+++ lldb/trunk/test/lang/objc/objc-static-method/TestObjCStaticMethod.py Wed Aug 3 11:23:08 2011
@@ -14,7 +14,6 @@
@python_api_test
#<rdar://problem/9745789> "expression" can't call functions in class methods
- @unittest2.expectedFailure
def test_with_dsym_and_python_api(self):
"""Test calling functions in static methods."""
self.buildDsym()
@@ -22,7 +21,6 @@
@python_api_test
#<rdar://problem/9745789> "expression" can't call functions in class methods
- @unittest2.expectedFailure
def test_with_dwarf_and_python_api(self):
"""Test calling functions in static methods."""
self.buildDwarf()
@@ -35,7 +33,6 @@
self.main_source = "static.m"
self.break_line = line_number(self.main_source, '// Set breakpoint here.')
- @unittest2.expectedFailure
#rdar://problem/9745789 "expression" can't call functions in class methods
def objc_static_method(self):
"""Test calling functions in static methods."""
@@ -66,7 +63,7 @@
cmd_value = frame.EvaluateExpression ("(char *) sel_getName (_cmd)")
self.assertTrue (cmd_value.IsValid())
sel_name = cmd_value.GetSummary()
- self.assertTrue (sel_name == "doSomethingWithString:", "Got the right value for the selector as string.")
+ self.assertTrue (sel_name == "\"doSomethingWithString:\"", "Got the right value for the selector as string.")
if __name__ == '__main__':
import atexit
Modified: lldb/trunk/test/lang/objc/objc-static-method/static.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/objc-static-method/static.m?rev=136784&r1=136783&r2=136784&view=diff
==============================================================================
--- lldb/trunk/test/lang/objc/objc-static-method/static.m (original)
+++ lldb/trunk/test/lang/objc/objc-static-method/static.m Wed Aug 3 11:23:08 2011
@@ -2,14 +2,17 @@
@interface Foo : NSObject
+(void) doSomethingWithString: (NSString *) string;
-
+-(void) doSomethingWithNothing;
@end
@implementation Foo
+(void) doSomethingWithString: (NSString *) string
{
NSLog (@"String is: %@.", string); // Set breakpoint here.
+}
+-(void) doSomethingWithNothing
+{
}
@end
More information about the lldb-commits
mailing list