[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 3 13:58:15 PST 2003


Changes in directory llvm/lib/Transforms/IPO:

FunctionResolution.cpp updated: 1.22 -> 1.23

---
Log message:

Eliminate tons of bogus warnings


---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.22 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.23
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.22	Thu Feb 27 14:55:48 2003
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp	Mon Mar  3 13:57:46 2003
@@ -128,7 +128,8 @@
       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 @@
       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





More information about the llvm-commits mailing list