Debuginfo: Correctly tag variadic ObjC methods with DW_TAG_unspecified_parameter.

Fixes rdar://13690847

llvm-svn: 215423
This commit is contained in:
Frederic Riss 2014-08-12 04:42:23 +00:00
parent fab63f7791
commit 787d9d640e
2 changed files with 19 additions and 0 deletions

View File

@ -2429,6 +2429,9 @@ llvm::DICompositeType CGDebugInfo::getOrCreateFunctionType(const Decl *D,
// 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);

View File

@ -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.
@interface Foo
- (void) Bar: (int) n, ...;
@end
@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}}}
}
@end