From 23eb67333460fca42cc99892eb69e1fe24e5f93a Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Tue, 25 Feb 2014 23:42:18 +0000 Subject: [PATCH] Address review comments for r202185, no functionality changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202208 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 5 +++-- test/CodeGenCXX/debug-info-varargs.cpp | 18 ++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 2de4dde127..2c357debb3 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -759,7 +759,7 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, EltTys.push_back(getOrCreateType(Ty->getReturnType(), Unit)); // Set up remainder of arguments if there is a prototype. - // FIXME: IF NOT, HOW IS THIS REPRESENTED? llvm-gcc doesn't represent '...'! + // otherwise emit it as a variadic function. if (isa(Ty)) EltTys.push_back(DBuilder.createUnspecifiedParameter()); else if (const FunctionProtoType *FPT = dyn_cast(Ty)) { @@ -2440,7 +2440,8 @@ llvm::DICompositeType CGDebugInfo::getOrCreateFunctionType(const Decl *D, return DBuilder.createSubroutineType(F, EltTypeArray); } - // Variadic function. + // Handle variadic function types; they need an additional + // unspecified parameter. if (const FunctionDecl *FD = dyn_cast(D)) if (FD->isVariadic()) { SmallVector EltTys; diff --git a/test/CodeGenCXX/debug-info-varargs.cpp b/test/CodeGenCXX/debug-info-varargs.cpp index de469642be..fa424e2c7b 100644 --- a/test/CodeGenCXX/debug-info-varargs.cpp +++ b/test/CodeGenCXX/debug-info-varargs.cpp @@ -4,21 +4,19 @@ struct A { // CHECK-DAG: ", i32 [[@LINE+1]], metadata ![[ATY:[0-9]+]]{{.*}}[ DW_TAG_subprogram ]{{.*}}[a] void a(int c, ...) {} - // CHECK-DAG: ![[ATY]] ={{.*}} metadata ![[AARGS:[0-9]+]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] - // CHECK-DAG: ![[AARGS]] = {{.*}} metadata ![[UNSPEC:[0-9]+]]} - // CHECK-DAG: ![[UNSPEC]] = metadata !{i32 786456} + // CHECK: ![[ATY]] ={{.*}} metadata ![[AARGS:[0-9]+]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] + // CHECK: ![[AARGS]] = {{.*}} metadata ![[UNSPEC:[0-9]+]]} + // CHECK: ![[UNSPEC]] = {{.*}} [ DW_TAG_unspecified_parameters ] }; - // CHECK-DAG: ", i32 [[@LINE+1]], metadata ![[BTY:[0-9]+]]{{.*}}[ DW_TAG_subprogram ]{{.*}}[b] + // CHECK: ", i32 [[@LINE+1]], metadata ![[BTY:[0-9]+]]{{.*}}[ DW_TAG_subprogram ]{{.*}}[b] void b(int c, ...) { - // CHECK-DAG: ![[BTY]] ={{.*}} metadata ![[BARGS:[0-9]+]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] - // CHECK-DAG: ![[BARGS]] = {{.*}} metadata ![[UNSPEC:[0-9]+]]} + // CHECK: ![[BTY]] ={{.*}} metadata ![[BARGS:[0-9]+]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] + // CHECK: ![[BARGS]] = {{.*}} metadata ![[UNSPEC:[0-9]+]]} A a; - // CHECK-DAG: metadata ![[PST:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [fptr] [line [[@LINE+1]]] + // CHECK: metadata ![[PST:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [fptr] [line [[@LINE+1]]] void (*fptr)(int, ...) = b; - // CHECK-DAG: ![[PST]] ={{.*}} metadata ![[ST:[0-9]+]]} ; [ DW_TAG_pointer_type ] - // CHECK-DAG: ![[ST]] ={{.*}} metadata ![[ARGS:[0-9]+]], i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] - // CHECK-DAG: ![[ARGS]] = {{.*}} metadata ![[UNSPEC]]} + // CHECK: ![[PST]] ={{.*}} metadata ![[BTY]]} ; [ DW_TAG_pointer_type ] } -- 2.40.0