Fix bug: CBackend/2003-05-13-VarArgFunction.ll
authorChris Lattner <sabre@nondot.org>
Tue, 13 May 2003 20:15:37 +0000 (20:15 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 13 May 2003 20:15:37 +0000 (20:15 +0000)
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
lib/Target/CBackend/Writer.cpp

index 3ab03e988e6f4239ec6ffdca761198aa95ebabd7..195a4f71ec6ee20d752a4dc2b48c6d81d8fe1704 100644 (file)
@@ -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();
index 3ab03e988e6f4239ec6ffdca761198aa95ebabd7..195a4f71ec6ee20d752a4dc2b48c6d81d8fe1704 100644 (file)
@@ -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();