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 3ab03e9..195a4f7 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -218,8 +218,9 @@
}
if (MTy->isVarArg()) {
if (!MTy->getParamTypes().empty())
- FunctionInards << ", ";
- FunctionInards << "...";
+ FunctionInards << ", ...";
+ } else if (MTy->getParamTypes().empty()) {
+ FunctionInards << "void";
}
FunctionInards << ")";
std::string tstr = FunctionInards.str();