aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-13 20:15:37 +0000
committerChris Lattner <sabre@nondot.org>2003-05-13 20:15:37 +0000
commitddfc03c8cb22f088e4465b3f1b8b759042b6b046 (patch)
treecc9b6f9aa275131f4d45d6f3975016d094011ccc /lib/Target
parentf3b467c2438ee12936eb77f8a81cde4f4e7d7fa4 (diff)
downloadexternal_llvm-ddfc03c8cb22f088e4465b3f1b8b759042b6b046.zip
external_llvm-ddfc03c8cb22f088e4465b3f1b8b759042b6b046.tar.gz
external_llvm-ddfc03c8cb22f088e4465b3f1b8b759042b6b046.tar.bz2
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
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/CBackend/CBackend.cpp5
-rw-r--r--lib/Target/CBackend/Writer.cpp5
2 files changed, 6 insertions, 4 deletions
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 @@ 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 3ab03e9..195a4f7 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();