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

Reid Spencer reid at x10sys.com
Tue Dec 13 11:57:02 PST 2005



Changes in directory llvm/lib/Transforms/IPO:

FunctionResolution.cpp updated: 1.57 -> 1.58
---
Log message:

Improve ResolveFunctions to:
a) use better local variable names (OldMT -> OldFT) where "M" is used to
   mean "Function" (perhaps it was previously "Method"?)
b) print out the module identifier in a warning message so that it is 
   possible to track down in which module the error occurred.


---
Diffs of the changes:  (+15 -13)

 FunctionResolution.cpp |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)


Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.57 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.58
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.57	Thu Apr 21 18:39:37 2005
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp	Tue Dec 13 13:56:51 2005
@@ -55,11 +55,11 @@
   for (unsigned i = 0; i != Globals.size(); ++i)
     if (Globals[i] != Concrete) {
       Function *Old = cast<Function>(Globals[i]);
-      const FunctionType *OldMT = Old->getFunctionType();
-      const FunctionType *ConcreteMT = Concrete->getFunctionType();
+      const FunctionType *OldFT = Old->getFunctionType();
+      const FunctionType *ConcreteFT = Concrete->getFunctionType();
 
-      if (OldMT->getNumParams() > ConcreteMT->getNumParams() &&
-          !ConcreteMT->isVarArg())
+      if (OldFT->getNumParams() > ConcreteFT->getNumParams() &&
+          !ConcreteFT->isVarArg())
         if (!Old->use_empty()) {
           std::cerr << "WARNING: Linking function '" << Old->getName()
                     << "' is causing arguments to be dropped.\n";
@@ -73,20 +73,22 @@
       // Check to make sure that if there are specified types, that they
       // match...
       //
-      unsigned NumArguments = std::min(OldMT->getNumParams(),
-                                       ConcreteMT->getNumParams());
+      unsigned NumArguments = std::min(OldFT->getNumParams(),
+                                       ConcreteFT->getNumParams());
 
       if (!Old->use_empty() && !Concrete->use_empty())
         for (unsigned i = 0; i < NumArguments; ++i)
-          if (OldMT->getParamType(i) != ConcreteMT->getParamType(i))
-            if (OldMT->getParamType(i)->getTypeID() !=
-                ConcreteMT->getParamType(i)->getTypeID()) {
+          if (OldFT->getParamType(i) != ConcreteFT->getParamType(i))
+            if (OldFT->getParamType(i)->getTypeID() !=
+                ConcreteFT->getParamType(i)->getTypeID()) {
               std::cerr << "WARNING: Function [" << Old->getName()
                         << "]: Parameter types conflict for: '";
-              WriteTypeSymbolic(std::cerr, OldMT, &M);
-              std::cerr << "' and '";
-              WriteTypeSymbolic(std::cerr, ConcreteMT, &M);
-              std::cerr << "'\n";
+              WriteTypeSymbolic(std::cerr, OldFT, &M);
+              std::cerr << "' (in " 
+                << Old->getParent()->getModuleIdentifier() << ") and '";
+              WriteTypeSymbolic(std::cerr, ConcreteFT, &M);
+              std::cerr << "'(in " 
+                << Concrete->getParent()->getModuleIdentifier() << ")\n";
               return Changed;
             }
 






More information about the llvm-commits mailing list