forked from OSchip/llvm-project
Recognize Objective-C classes with runtime class
ObjCPlusPlus as Objective-C classes. Really the compiler should say they have Objective-C runtime class, but we should be a little more resilient (we were refusing to find ivars in those classes before). Also added a test case. llvm-svn: 155515
This commit is contained in:
parent
6d98f56c58
commit
7457f8d7c9
|
@ -5247,7 +5247,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
is_forward_declaration = true;
|
||||
}
|
||||
|
||||
if (class_language == eLanguageTypeObjC)
|
||||
if (class_language == eLanguageTypeObjC ||
|
||||
class_language == eLanguageTypeObjC_plus_plus)
|
||||
{
|
||||
if (!is_complete_objc_class && Supports_DW_AT_APPLE_objc_complete_type(dwarf_cu))
|
||||
{
|
||||
|
@ -5444,7 +5445,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// declaration context for a contained class or type without the need
|
||||
// to complete that type..
|
||||
|
||||
if (class_language != eLanguageTypeObjC)
|
||||
if (class_language != eLanguageTypeObjC &&
|
||||
class_language != eLanguageTypeObjC_plus_plus)
|
||||
ast.StartTagDeclarationDefinition (clang_type);
|
||||
|
||||
// Leave this as a forward declaration until we need
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
LEVEL = ../../../make
|
||||
|
||||
OBJCXX_SOURCES := main.mm
|
||||
|
||||
include $(LEVEL)/Makefile.rules
|
||||
|
||||
LDFLAGS += -framework Foundation
|
||||
|
||||
main.o: main.mm
|
||||
$(CXX) $(CXXFLAGS) -c -o main.o main.mm
|
|
@ -0,0 +1,47 @@
|
|||
"""
|
||||
Make sure that ivars of Objective-C++ classes are visible in LLDB.
|
||||
"""
|
||||
|
||||
import os, time
|
||||
import unittest2
|
||||
import lldb
|
||||
from lldbtest import *
|
||||
|
||||
class ObjCXXTestCase(TestBase):
|
||||
|
||||
mydir = os.path.join("lang", "objc", "objc++")
|
||||
|
||||
@dsym_test
|
||||
def test_break_with_dsym(self):
|
||||
"""Test ivars of Objective-C++ classes"""
|
||||
if self.getArchitecture() == 'i386':
|
||||
self.skipTest("requires Objective-C 2.0 runtime")
|
||||
self.buildDsym()
|
||||
self.do_testObjCXXClasses()
|
||||
|
||||
@dwarf_test
|
||||
def test_break_with_dwarf(self):
|
||||
"""Test ivars of Objective-C++ classes"""
|
||||
if self.getArchitecture() == 'i386':
|
||||
self.skipTest("requires Objective-C 2.0 runtime")
|
||||
self.buildDwarf()
|
||||
self.do_testObjCXXClasses()
|
||||
|
||||
def do_testObjCXXClasses(self):
|
||||
"""Test ivars of Objective-C++ classes"""
|
||||
exe = os.path.join(os.getcwd(), "a.out")
|
||||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
self.expect("breakpoint set -p 'breakpoint 1'", BREAKPOINT_CREATED,
|
||||
startstr = "Breakpoint created")
|
||||
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
||||
self.expect("expr f->f", "Found ivar in class",
|
||||
substrs = ["= 3"])
|
||||
|
||||
if __name__ == '__main__':
|
||||
import atexit
|
||||
lldb.SBDebugger.Initialize()
|
||||
atexit.register(lambda: lldb.SBDebugger.Terminate())
|
||||
unittest2.main()
|
Binary file not shown.
|
@ -0,0 +1,19 @@
|
|||
#include <Foundation/NSObject.h>
|
||||
|
||||
@interface F : NSObject
|
||||
@end
|
||||
|
||||
@implementation F
|
||||
{
|
||||
@public
|
||||
int f;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
F* f = [F new];
|
||||
f->f = 3;
|
||||
return 0; // breakpoint 1
|
||||
}
|
Loading…
Reference in New Issue