From c046497bf087f00e520b112c07cbaa6a44d7ea31 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Thu, 27 Oct 2016 18:44:45 +0000 Subject: Add support for "type lookup" to find C and C++ types This is an important first step in closing the functionality gap between "type lookup" and "images lookup -t" rdar://28971388 llvm-svn: 285332 --- .../test/functionalities/type_lookup/Makefile | 2 +- .../functionalities/type_lookup/TestTypeLookup.py | 6 ++-- .../test/functionalities/type_lookup/main.m | 16 ---------- .../test/functionalities/type_lookup/main.mm | 36 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 19 deletions(-) delete mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m create mode 100644 lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm (limited to 'lldb/packages/Python/lldbsuite/test') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile index 31e57fe28a5..7fb4d7a5ab1 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile +++ b/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/Makefile @@ -1,6 +1,6 @@ LEVEL = ../../make -OBJC_SOURCES := main.m +OBJCXX_SOURCES := main.mm CFLAGS_EXTRAS += -w diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py b/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py index dc4f125e372..62f7766604c 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py @@ -22,7 +22,7 @@ class TypeLookupTestCase(TestBase): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break at. - self.line = line_number('main.m', '// break here') + self.line = line_number('main.mm', '// break here') @skipUnlessDarwin @skipIf(archs=['i386']) @@ -32,7 +32,7 @@ class TypeLookupTestCase(TestBase): self.runCmd("file a.out", CURRENT_EXECUTABLE_SET) lldbutil.run_break_set_by_file_and_line( - self, "main.m", self.line, num_expected_locations=1, loc_exact=True) + self, "main.mm", self.line, num_expected_locations=1, loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) @@ -50,3 +50,5 @@ class TypeLookupTestCase(TestBase): self.expect('type lookup NSObject', substrs=['NSObject', 'isa']) self.expect('type lookup PleaseDontBeARealTypeThatExists', substrs=[ "no type was found matching 'PleaseDontBeARealTypeThatExists'"]) + self.expect('type lookup MyCPPClass', substrs=['setF', 'float getF']) + self.expect('type lookup MyClass', substrs=['setF', 'float getF']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m deleted file mode 100644 index 058a0c00e92..00000000000 --- a/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.m +++ /dev/null @@ -1,16 +0,0 @@ -//===-- main.m ------------------------------------------------*- ObjC -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#import - -int main (int argc, const char * argv[]) -{ - return 0; // break here -} - diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm b/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm new file mode 100644 index 00000000000..d522e0b16d7 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/main.mm @@ -0,0 +1,36 @@ +//===-- main.mm -----------------------------------------------*- ObjC -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#import + +class MyCPPClass { +public: + MyCPPClass(float f) : f(f) {} + + float setF(float f) { + float oldf = this->f; + this->f = f; + return oldf; + } + + float getF() { + return f; + } +private: + float f; +}; + +typedef MyCPPClass MyClass; + +int main (int argc, const char * argv[]) +{ + MyClass my_cpp(3.1415); + return 0; // break here +} + -- cgit v1.2.3