r215423 - Debuginfo: Correctly tag variadic ObjC methods with DW_TAG_unspecified_parameter.

Frederic Riss friss at apple.com
Mon Aug 11 21:42:23 PDT 2014


Author: friss
Date: Mon Aug 11 23:42:23 2014
New Revision: 215423

URL: http://llvm.org/viewvc/llvm-project?rev=215423&view=rev
Log:
Debuginfo: Correctly tag variadic ObjC methods with DW_TAG_unspecified_parameter.

Fixes rdar://13690847

Added:
    cfe/trunk/test/CodeGenObjC/debug-info-variadic-method.m
Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=215423&r1=215422&r2=215423&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Aug 11 23:42:23 2014
@@ -2429,6 +2429,9 @@ llvm::DICompositeType CGDebugInfo::getOr
     // Get rest of the arguments.
     for (const auto *PI : OMethod->params())
       Elts.push_back(getOrCreateType(PI->getType(), F));
+    // Variadic methods need a special marker at the end of the type list.
+    if (OMethod->isVariadic())
+      Elts.push_back(DBuilder.createUnspecifiedParameter());
 
     llvm::DITypeArray EltTypeArray = DBuilder.getOrCreateTypeArray(Elts);
     return DBuilder.createSubroutineType(F, EltTypeArray);

Added: cfe/trunk/test/CodeGenObjC/debug-info-variadic-method.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-variadic-method.m?rev=215423&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-variadic-method.m (added)
+++ cfe/trunk/test/CodeGenObjC/debug-info-variadic-method.m Mon Aug 11 23:42:23 2014
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -o - -emit-llvm -g %s | FileCheck %s
+
+// This test verifies that variadic ObjC methods get the
+// DW_TAG_unspecified_parameter marker.
+
+ at interface Foo
+- (void) Bar: (int) n, ...;
+ at end
+
+ at implementation Foo
+- (void) Bar: (int) n, ...
+{
+  // CHECK: metadata ![[NUM:[^,]*]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ]
+  // CHECK: ![[NUM]] = {{metadata !{null, metadata ![^,]*, metadata ![^,]*, metadata ![^,]*, null}}}    
+}
+ at end





More information about the cfe-commits mailing list