From ddfc03c8cb22f088e4465b3f1b8b759042b6b046 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 13 May 2003 20:15:37 +0000 Subject: [PATCH] Fix bug: CBackend/2003-05-13-VarArgFunction.ll In C, a prototype with no arguments is varargs. A prototype that takes void has zero args. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6172 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 5 +++-- lib/Target/CBackend/Writer.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 3ab03e988e6..195a4f71ec6 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -218,8 +218,9 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, } if (MTy->isVarArg()) { if (!MTy->getParamTypes().empty()) - FunctionInards << ", "; - FunctionInards << "..."; + FunctionInards << ", ..."; + } else if (MTy->getParamTypes().empty()) { + FunctionInards << "void"; } FunctionInards << ")"; std::string tstr = FunctionInards.str(); diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 3ab03e988e6..195a4f71ec6 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -218,8 +218,9 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty, } if (MTy->isVarArg()) { if (!MTy->getParamTypes().empty()) - FunctionInards << ", "; - FunctionInards << "..."; + FunctionInards << ", ..."; + } else if (MTy->getParamTypes().empty()) { + FunctionInards << "void"; } FunctionInards << ")"; std::string tstr = FunctionInards.str(); -- 2.34.1