From: Chris Lattner Date: Tue, 13 May 2003 20:15:37 +0000 (+0000) Subject: Fix bug: CBackend/2003-05-13-VarArgFunction.ll X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ddfc03c8cb22f088e4465b3f1b8b759042b6b046;p=oota-llvm.git 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 --- 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();