[cfe-commits] r90936 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/vfprintf.c
Eli Friedman
eli.friedman at gmail.com
Tue Dec 8 19:05:59 PST 2009
Author: efriedma
Date: Tue Dec 8 21:05:59 2009
New Revision: 90936
URL: http://llvm.org/viewvc/llvm-project?rev=90936&view=rev
Log:
Fix for PR5709: use the computed type of the declaration instead of the
type of the builtin when generating the function declaration for a builtin
library call.
Added:
cfe/trunk/test/CodeGen/vfprintf.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=90936&r1=90935&r2=90936&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Dec 8 21:05:59 2009
@@ -1253,13 +1253,8 @@
if (Context.BuiltinInfo.isLibFunction(BuiltinID))
Name += 10;
- // Get the type for the builtin.
- ASTContext::GetBuiltinTypeError Error;
- QualType Type = Context.GetBuiltinType(BuiltinID, Error);
- assert(Error == ASTContext::GE_None && "Can't get builtin type");
-
const llvm::FunctionType *Ty =
- cast<llvm::FunctionType>(getTypes().ConvertType(Type));
+ cast<llvm::FunctionType>(getTypes().ConvertType(FD->getType()));
// Unique the name through the identifier table.
Name = getContext().Idents.get(Name).getNameStart();
Added: cfe/trunk/test/CodeGen/vfprintf.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/vfprintf.c?rev=90936&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/vfprintf.c (added)
+++ cfe/trunk/test/CodeGen/vfprintf.c Tue Dec 8 21:05:59 2009
@@ -0,0 +1,8 @@
+// RUN: clang-cc -emit-llvm-only %s
+
+typedef struct _IO_FILE FILE;
+int vfprintf(FILE*restrict,const char*restrict, __builtin_va_list);
+void foo(__builtin_va_list ap) {
+ vfprintf(0, " ", ap);
+}
+
More information about the cfe-commits
mailing list