summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/FunctionResolution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-03-03 19:57:46 +0000
committerChris Lattner <sabre@nondot.org>2003-03-03 19:57:46 +0000
commitdde601d0eb6ffe64aea2f72e0baf8548247dbb4c (patch)
tree5a5886e8b87cb30bd69e6c83d0b772a0f564b3f2 /lib/Transforms/IPO/FunctionResolution.cpp
parentfb743a937f6856e3ab1f8ed599677038750a550e (diff)
downloadllvm-dde601d0eb6ffe64aea2f72e0baf8548247dbb4c.tar.gz
llvm-dde601d0eb6ffe64aea2f72e0baf8548247dbb4c.tar.bz2
llvm-dde601d0eb6ffe64aea2f72e0baf8548247dbb4c.tar.xz
Eliminate tons of bogus warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/FunctionResolution.cpp')
-rw-r--r--lib/Transforms/IPO/FunctionResolution.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index 44c6dfa31c..734b62b9dc 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -128,7 +128,8 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
const FunctionType *OldMT = Old->getFunctionType();
const FunctionType *ConcreteMT = Concrete->getFunctionType();
- if (OldMT->getParamTypes().size() <= ConcreteMT->getParamTypes().size())
+ if (OldMT->getParamTypes().size() < ConcreteMT->getParamTypes().size() &&
+ !ConcreteMT->isVarArg())
if (!Old->use_empty()) {
std::cerr << "WARNING: Linking function '" << Old->getName()
<< "' is causing arguments to be dropped.\n";
@@ -145,13 +146,14 @@ static bool ResolveFunctions(Module &M, std::vector<GlobalValue*> &Globals,
unsigned NumArguments = std::min(OldMT->getParamTypes().size(),
ConcreteMT->getParamTypes().size());
- for (unsigned i = 0; i < NumArguments; ++i)
- if (OldMT->getParamTypes()[i] != ConcreteMT->getParamTypes()[i]) {
- std::cerr << "funcresolve: Function [" << Old->getName()
- << "]: Parameter types conflict for: '" << OldMT
- << "' and '" << ConcreteMT << "'\n";
- return Changed;
- }
+ if (!Old->use_empty() && !Concrete->use_empty())
+ for (unsigned i = 0; i < NumArguments; ++i)
+ if (OldMT->getParamTypes()[i] != ConcreteMT->getParamTypes()[i]) {
+ std::cerr << "WARNING: Function [" << Old->getName()
+ << "]: Parameter types conflict for: '" << OldMT
+ << "' and '" << ConcreteMT << "'\n";
+ return Changed;
+ }
// Attempt to convert all of the uses of the old function to the
// concrete form of the function. If there is a use of the fn that