[cfe-commits] r84922 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp lib/CodeGen/CGDebugInfo.h lib/CodeGen/CodeGenFunction.cpp test/CodeGen/debug-info.c

Mike Stump mrs at apple.com
Thu Oct 22 18:52:13 PDT 2009


Author: mrs
Date: Thu Oct 22 20:52:13 2009
New Revision: 84922

URL: http://llvm.org/viewvc/llvm-project?rev=84922&view=rev
Log:
Fixup the return type of functions.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
    cfe/trunk/test/CodeGen/debug-info.c

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=84922&r1=84921&r2=84922&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Oct 22 20:52:13 2009
@@ -888,7 +888,7 @@
 
 /// EmitFunctionStart - Constructs the debug code for entering a function -
 /// "llvm.dbg.func.start.".
-void CGDebugInfo::EmitFunctionStart(const char *Name, QualType ReturnType,
+void CGDebugInfo::EmitFunctionStart(const char *Name, QualType FnType,
                                     llvm::Function *Fn,
                                     CGBuilderTy &Builder) {
   const char *LinkageName = Name;
@@ -906,7 +906,7 @@
 
   llvm::DISubprogram SP =
     DebugFactory.CreateSubprogram(Unit, Name, Name, LinkageName, Unit, LineNo,
-                                  getOrCreateType(ReturnType, Unit),
+                                  getOrCreateType(FnType, Unit),
                                   Fn->hasInternalLinkage(), true/*definition*/);
 
 #ifndef ATTACH_DEBUG_INFO_TO_AN_INSN

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=84922&r1=84921&r2=84922&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Oct 22 20:52:13 2009
@@ -88,7 +88,7 @@
 
   /// EmitFunctionStart - Emit a call to llvm.dbg.function.start to indicate
   /// start of a new function.
-  void EmitFunctionStart(const char *Name, QualType ReturnType,
+  void EmitFunctionStart(const char *Name, QualType FnType,
                          llvm::Function *Fn, CGBuilderTy &Builder);
 
   /// EmitRegionStart - Emit a call to llvm.dbg.region.start to indicate start

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=84922&r1=84921&r2=84922&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Thu Oct 22 20:52:13 2009
@@ -167,18 +167,20 @@
 
   Builder.SetInsertPoint(EntryBB);
 
+  QualType FnType = getContext().getFunctionType(RetTy, 0, 0, false, 0);
+
   // Emit subprogram debug descriptor.
   // FIXME: The cast here is a huge hack.
   if (CGDebugInfo *DI = getDebugInfo()) {
     DI->setLocation(StartLoc);
     if (isa<FunctionDecl>(D)) {
-      DI->EmitFunctionStart(CGM.getMangledName(GD), RetTy, CurFn, Builder);
+      DI->EmitFunctionStart(CGM.getMangledName(GD), FnType, CurFn, Builder);
     } else {
       // Just use LLVM function name.
 
       // FIXME: Remove unnecessary conversion to std::string when API settles.
       DI->EmitFunctionStart(std::string(Fn->getName()).c_str(),
-                            RetTy, CurFn, Builder);
+                            FnType, CurFn, Builder);
     }
   }
 

Modified: cfe/trunk/test/CodeGen/debug-info.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info.c?rev=84922&r1=84921&r2=84922&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/debug-info.c (original)
+++ cfe/trunk/test/CodeGen/debug-info.c Thu Oct 22 20:52:13 2009
@@ -1,10 +1,12 @@
-// RUN: clang-cc -o %t --emit-llvm -g %s
+// RUN: clang-cc -o %t --emit-llvm -g %s &&
+// RUN: FileCheck --input-file=%t %s
 
 // PR3023
 void convert(void) {
   struct { typeof(0) f0; } v0;
 }
 
+
 // PR2784
 struct OPAQUE;
 typedef struct OPAQUE *PTR;
@@ -19,9 +21,11 @@
   return a0->p;
 }
 
+
 // PR3134
 char xpto[];
 
+
 // PR3427
 struct foo {
   int a;
@@ -29,9 +33,16 @@
 };
 struct foo bar;
 
+
 // PR4143
 struct foo2 {
   enum bar *bar;
 };
 
 struct foo2 foo2;
+
+
+// CHECK: "barfoo"
+typedef int barfoo;
+barfoo foo() {
+}





More information about the cfe-commits mailing list