[cfe-commits] r142700 - in /cfe/trunk: lib/CodeGen/CodeGenFunction.cpp test/CodeGen/debug-info-args.c test/CodeGenCXX/debug-info-fn-template.cpp

Eric Christopher echristo at apple.com
Fri Oct 21 16:30:10 PDT 2011


Author: echristo
Date: Fri Oct 21 18:30:10 2011
New Revision: 142700

URL: http://llvm.org/viewvc/llvm-project?rev=142700&view=rev
Log:
Fix PR11073 by adding the argument type information to the decl we construct
for the function type. Update a testcase accordingly.

Patch initially by Anders Waldenborg!

Added:
    cfe/trunk/test/CodeGen/debug-info-args.c
Modified:
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
    cfe/trunk/test/CodeGenCXX/debug-info-fn-template.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=142700&r1=142699&r2=142700&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Oct 21 18:30:10 2011
@@ -298,12 +298,19 @@
 
   // Emit subprogram debug descriptor.
   if (CGDebugInfo *DI = getDebugInfo()) {
-    // FIXME: what is going on here and why does it ignore all these
-    // interesting type properties?
+    unsigned NumArgs = 0;
+    QualType *ArgsArray = new QualType[Args.size()];
+    for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
+	 i != e; ++i) {
+      ArgsArray[NumArgs++] = (*i)->getType();
+    }
+
     QualType FnType =
-      getContext().getFunctionType(RetTy, 0, 0,
+      getContext().getFunctionType(RetTy, ArgsArray, NumArgs,
                                    FunctionProtoType::ExtProtoInfo());
 
+    delete ArgsArray;
+
     DI->setLocation(StartLoc);
     DI->EmitFunctionStart(GD, FnType, CurFn, Builder);
   }

Added: cfe/trunk/test/CodeGen/debug-info-args.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-args.c?rev=142700&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-args.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-args.c Fri Oct 21 18:30:10 2011
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -g %s | FileCheck %s
+
+int somefunc(char *x, int y, double z) {
+  
+  // CHECK: {{.*metadata !8, i32 0, i32 0}.*DW_TAG_subroutine_type}}
+  // CHECK: {{!8 = .*metadata ![^,]*, metadata ![^,]*, metadata ![^,]*, metadata ![^,]*}}
+  
+  return y;
+}

Modified: cfe/trunk/test/CodeGenCXX/debug-info-fn-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-fn-template.cpp?rev=142700&r1=142699&r2=142700&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-fn-template.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-fn-template.cpp Fri Oct 21 18:30:10 2011
@@ -10,6 +10,6 @@
   return xi.member;
 }
 
-//CHECK: DW_TAG_template_type_parameter
 //CHECK: XF<int>
+//CHECK: DW_TAG_template_type_parameter
 template int fx(XF<int>);





More information about the cfe-commits mailing list