]> granicus.if.org Git - clang/commitdiff
Fix PR11073 by adding the argument type information to the decl we construct
authorEric Christopher <echristo@apple.com>
Fri, 21 Oct 2011 23:30:10 +0000 (23:30 +0000)
committerEric Christopher <echristo@apple.com>
Fri, 21 Oct 2011 23:30:10 +0000 (23:30 +0000)
for the function type. Update a testcase accordingly.

Patch initially by Anders Waldenborg!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142700 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp
test/CodeGen/debug-info-args.c [new file with mode: 0644]
test/CodeGenCXX/debug-info-fn-template.cpp

index 8191f021da4a08a729e4ff868c195246de2a2af2..7036682eb56dd609b300d50b940221a211c64b19 100644 (file)
@@ -298,12 +298,19 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
 
   // 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);
   }
diff --git a/test/CodeGen/debug-info-args.c b/test/CodeGen/debug-info-args.c
new file mode 100644 (file)
index 0000000..1d4ea10
--- /dev/null
@@ -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;
+}
index c8291af852d3d3df062e765c2b06e92a31d5f979..bef9fe144028e0c4d8e2d39c95fa81318a9d9741 100644 (file)
@@ -10,6 +10,6 @@ T fx(XF<T> xi) {
   return xi.member;
 }
 
-//CHECK: DW_TAG_template_type_parameter
 //CHECK: XF<int>
+//CHECK: DW_TAG_template_type_parameter
 template int fx(XF<int>);