Fix bug: 2002-09-20-VarArgPrototypes.ll
authorChris Lattner <sabre@nondot.org>
Fri, 20 Sep 2002 22:32:30 +0000 (22:32 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 20 Sep 2002 22:32:30 +0000 (22:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3870 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 7501a9bfde2aa07a359a79172b5fc042563339a8..e993b740f412f620b9fe79f21aecffbbae6afd85 100644 (file)
@@ -683,8 +683,10 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
     }
   }
 
-  // Finish printing arguments...
-  if (FT->isVarArg()) {
+  // Finish printing arguments... if this is a vararg function, print the ...,
+  // unless there are no known types, in which case, we just emit ().
+  //
+  if (FT->isVarArg() && !FT->getParamTypes().empty()) {
     if (FT->getParamTypes().size()) Out << ", ";
     Out << "...";  // Output varargs portion of signature!
   }
index 7501a9bfde2aa07a359a79172b5fc042563339a8..e993b740f412f620b9fe79f21aecffbbae6afd85 100644 (file)
@@ -683,8 +683,10 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
     }
   }
 
-  // Finish printing arguments...
-  if (FT->isVarArg()) {
+  // Finish printing arguments... if this is a vararg function, print the ...,
+  // unless there are no known types, in which case, we just emit ().
+  //
+  if (FT->isVarArg() && !FT->getParamTypes().empty()) {
     if (FT->getParamTypes().size()) Out << ", ";
     Out << "...";  // Output varargs portion of signature!
   }