aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-09 03:05:59 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-09 03:05:59 +0000
commit386ca78d0b03b1fb519e60d1a14cd12a220364a6 (patch)
tree5aacb53c795e8f576a1499bae1900247f44bf691
parentb6cc91be4da4f55c7e3dca87ecfdb532b33c83ca (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90936 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CodeGenModule.cpp7
-rw-r--r--test/CodeGen/vfprintf.c8
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index a063e21307..e98939cc8f 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1253,13 +1253,8 @@ llvm::Value *CodeGenModule::getBuiltinLibFunction(const FunctionDecl *FD,
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();
diff --git a/test/CodeGen/vfprintf.c b/test/CodeGen/vfprintf.c
new file mode 100644
index 0000000000..89261c7469
--- /dev/null
+++ b/test/CodeGen/vfprintf.c
@@ -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);
+}
+