[Lldb-commits] [lldb] r273632 - Handle variadic Objective-C methods from DWARF correctly.

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 23 17:24:40 PDT 2016


Author: spyffe
Date: Thu Jun 23 19:24:40 2016
New Revision: 273632

URL: http://llvm.org/viewvc/llvm-project?rev=273632&view=rev
Log:
Handle variadic Objective-C methods from DWARF correctly.

<rdar://problem/22039804>

Added:
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py
    lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/main.m
Modified:
    lldb/trunk/include/lldb/Symbol/ClangASTContext.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=273632&r1=273631&r2=273632&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Jun 23 19:24:40 2016
@@ -1038,7 +1038,8 @@ public:
                                const char *name,  // the full symbol name as seen in the symbol table (lldb::opaque_compiler_type_t type, "-[NString stringWithCString:]")
                                const CompilerType &method_compiler_type,
                                lldb::AccessType access,
-                               bool is_artificial);
+                               bool is_artificial,
+                               bool is_variadic);
     
     static bool
     SetHasExternalStorage (lldb::opaque_compiler_type_t type, bool has_extern);

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py?rev=273632&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py Thu Jun 23 19:24:40 2016
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])

Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/main.m?rev=273632&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/main.m (added)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/main.m Thu Jun 23 19:24:40 2016
@@ -0,0 +1,31 @@
+//===-- main.m -------------------------------------------*- Objective-C-*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#import <Foundation/Foundation.h>
+
+ at interface VarClass : NSObject
+- (id) lottaArgs: (id) first, ...;
+ at end
+
+ at implementation VarClass
+- (id) lottaArgs: (id) first, ...
+{
+  return first;
+}
+ at end
+
+int
+main()
+{
+  VarClass *my_var = [[VarClass alloc] init];
+  id something = [my_var lottaArgs: @"111", @"222", nil];
+  NSLog (@"%@ - %@", my_var, something); //% self.expect("expression -O -- [my_var lottaArgs:@\"111\", @\"222\", nil]", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["111"])
+  return 0;
+}
+

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=273632&r1=273631&r2=273632&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Thu Jun 23 19:24:40 2016
@@ -1352,7 +1352,8 @@ DWARFASTParserClang::ParseTypeFromDWARF
                                                                                                                type_name_cstr,
                                                                                                                clang_type,
                                                                                                                accessibility,
-                                                                                                               is_artificial);
+                                                                                                               is_artificial,
+                                                                                                               is_variadic);
                                     type_handled = objc_method_decl != NULL;
                                     if (type_handled)
                                     {

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=273632&r1=273631&r2=273632&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Jun 23 19:24:40 2016
@@ -8331,7 +8331,8 @@ ClangASTContext::AddMethodToObjCObjectTy
                                             const char *name,  // the full symbol name as seen in the symbol table (lldb::opaque_compiler_type_t type, "-[NString stringWithCString:]")
                                             const CompilerType &method_clang_type,
                                             lldb::AccessType access,
-                                            bool is_artificial)
+                                            bool is_artificial,
+                                            bool is_variadic)
 {
     if (!type || !method_clang_type.IsValid())
         return nullptr;
@@ -8391,7 +8392,6 @@ ClangASTContext::AddMethodToObjCObjectTy
         return nullptr;
     
     
-    bool is_variadic = false;
     bool is_synthesized = false;
     bool is_defined = false;
     clang::ObjCMethodDecl::ImplementationControl imp_control = clang::ObjCMethodDecl::None;




More information about the lldb-commits mailing list