summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-28 16:42:50 +0000
committerChris Lattner <sabre@nondot.org>2003-08-28 16:42:50 +0000
commit841e00b96295a2b66cb7573e961656d28a6cb12b (patch)
treeb174cd6562028e4c5fc2d4db7e3a9d0b4d97834a
parenta55c4b1ce71bf62b669d5e533544a29739d56a98 (diff)
downloadllvm-841e00b96295a2b66cb7573e961656d28a6cb12b.tar.gz
llvm-841e00b96295a2b66cb7573e961656d28a6cb12b.tar.bz2
llvm-841e00b96295a2b66cb7573e961656d28a6cb12b.tar.xz
Fix bug where we considered function types equivalent even if they had differing numbers of arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8178 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Linker/LinkModules.cpp4
-rw-r--r--lib/Transforms/Utils/Linker.cpp4
-rw-r--r--lib/VMCore/Linker.cpp4
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 5280c04565..81d46ca3f4 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -79,7 +79,9 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy,
switch (DestTyT->getPrimitiveID()) {
case Type::FunctionTyID: {
if (cast<FunctionType>(DestTyT)->isVarArg() !=
- cast<FunctionType>(SrcTyT)->isVarArg())
+ cast<FunctionType>(SrcTyT)->isVarArg() ||
+ cast<FunctionType>(DestTyT)->getNumContainedTypes() !=
+ cast<FunctionType>(SrcTyT)->getNumContainedTypes())
return true;
for (unsigned i = 0, e = getFT(DestTy)->getNumContainedTypes(); i != e; ++i)
if (RecursiveResolveTypesI(getFT(DestTy)->getContainedType(i),
diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp
index 5280c04565..81d46ca3f4 100644
--- a/lib/Transforms/Utils/Linker.cpp
+++ b/lib/Transforms/Utils/Linker.cpp
@@ -79,7 +79,9 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy,
switch (DestTyT->getPrimitiveID()) {
case Type::FunctionTyID: {
if (cast<FunctionType>(DestTyT)->isVarArg() !=
- cast<FunctionType>(SrcTyT)->isVarArg())
+ cast<FunctionType>(SrcTyT)->isVarArg() ||
+ cast<FunctionType>(DestTyT)->getNumContainedTypes() !=
+ cast<FunctionType>(SrcTyT)->getNumContainedTypes())
return true;
for (unsigned i = 0, e = getFT(DestTy)->getNumContainedTypes(); i != e; ++i)
if (RecursiveResolveTypesI(getFT(DestTy)->getContainedType(i),
diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp
index 5280c04565..81d46ca3f4 100644
--- a/lib/VMCore/Linker.cpp
+++ b/lib/VMCore/Linker.cpp
@@ -79,7 +79,9 @@ static bool RecursiveResolveTypesI(const PATypeHolder &DestTy,
switch (DestTyT->getPrimitiveID()) {
case Type::FunctionTyID: {
if (cast<FunctionType>(DestTyT)->isVarArg() !=
- cast<FunctionType>(SrcTyT)->isVarArg())
+ cast<FunctionType>(SrcTyT)->isVarArg() ||
+ cast<FunctionType>(DestTyT)->getNumContainedTypes() !=
+ cast<FunctionType>(SrcTyT)->getNumContainedTypes())
return true;
for (unsigned i = 0, e = getFT(DestTy)->getNumContainedTypes(); i != e; ++i)
if (RecursiveResolveTypesI(getFT(DestTy)->getContainedType(i),