[Lldb-commits] [PATCH] D11173: Compile and run objc tests in TestObjCBuiltinTypes.py as objc instead of c++.

Dawn Perchik dawn+llvm at burble.org
Mon Jul 13 21:24:15 PDT 2015


dawn created this revision.
dawn added reviewers: spyffe, clayborg, granata.enrico.
dawn added a subscriber: lldb-commits.
dawn set the repository for this revision to rL LLVM.

The tests in TestObjCBuiltinTypes.py were compiled as C++ which didn't properly define the builtin ObjC type 'id' and caused the DWARF to claim the language was C++ instead of ObjC.  As a result, when the language in lldb is set to C++ as read from the DWARF, the test would fail.  This fix is a prerequisite to recognizing the language from the DWARF and setting the compiler options accordingly. 

Repository:
  rL LLVM

http://reviews.llvm.org/D11173

Files:
  test/lang/objc/objc-builtin-types/Makefile
  test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
  test/lang/objc/objc-builtin-types/main.cpp
  test/lang/objc/objc-builtin-types/main.mm

Index: test/lang/objc/objc-builtin-types/main.mm
===================================================================
--- test/lang/objc/objc-builtin-types/main.mm
+++ test/lang/objc/objc-builtin-types/main.mm
@@ -1,9 +1,9 @@
 namespace ns {
-  typedef int id;
+  typedef id ns_id;
 };
 
 int main()
 {
-  ns::id foo = 0;
-  return foo; // Set breakpoint here.
+  ns::ns_id foo = 0;
+  return foo == 0 ? 0 : 1; // Set breakpoint here.
 }
Index: test/lang/objc/objc-builtin-types/main.cpp
===================================================================
--- test/lang/objc/objc-builtin-types/main.cpp
+++ test/lang/objc/objc-builtin-types/main.cpp
@@ -1,9 +0,0 @@
-namespace ns {
-  typedef int id;
-};
-
-int main()
-{
-  ns::id foo = 0;
-  return foo; // Set breakpoint here.
-}
Index: test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
===================================================================
--- test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
+++ test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
@@ -30,7 +30,7 @@
         # Call super's setUp().
         TestBase.setUp(self)
         # Find the line numbers to break inside main().
-        self.main_source = "main.cpp"
+        self.main_source = "main.mm"
         self.break_line = line_number(self.main_source, '// Set breakpoint here.')
 
     #<rdar://problem/10591460> [regression] Can't print ivar value: error: reference to 'id' is ambiguous
@@ -60,7 +60,7 @@
         frame = thread_list[0].GetFrameAtIndex(0)
         self.assertTrue (frame, "Got a valid frame 0 frame.")
 
-        self.expect("expr (foo)", patterns = ["\(ns::id\) \$.* = 0"])
+        self.expect("expr (foo)", patterns = ["\(ns::ns_id\) \$.* = nil"])
 
         self.expect("expr id my_id = 0; my_id", patterns = ["\(id\) \$.* = nil"])
 
Index: test/lang/objc/objc-builtin-types/Makefile
===================================================================
--- test/lang/objc/objc-builtin-types/Makefile
+++ test/lang/objc/objc-builtin-types/Makefile
@@ -1,5 +1,6 @@
 LEVEL = ../../../make
 
-CXX_SOURCES := main.cpp
+OBJCXX_SOURCES := main.mm
+LD_EXTRAS = -framework Foundation
 
 include $(LEVEL)/Makefile.rules


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11173.29641.patch
Type: text/x-patch
Size: 2190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150714/7df3ed91/attachment.bin>


More information about the lldb-commits mailing list