[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Fri Aug 6 08:13:16 PDT 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.81 -> 1.82
---
Log message:

Fix bug where types of overriden functions mismatched.


---
Diffs of the changes:  (+11 -7)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.81 llvm-java/lib/Compiler/Compiler.cpp:1.82
--- llvm-java/lib/Compiler/Compiler.cpp:1.81	Fri Aug  6 09:45:07 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Fri Aug  6 10:13:05 2004
@@ -330,17 +330,21 @@
             std::string methodDescr =
               method->getName()->str() +
               method->getDescriptor()->str();
-            unsigned& index = vi.m2iMap[methodDescr];
-            Function* vfun = module_->getOrInsertFunction
-              (className + '/' + methodDescr,
-               cast<FunctionType>(getType(method->getDescriptor(),
-                                          getClassInfo(className).type)));
+
+            std::string funcName = className + '/' + methodDescr;
+            const FunctionType* funcTy = cast<FunctionType>(
+              getType(method->getDescriptor(), getClassInfo(className).type));
+
+            Function* vfun = module_->getOrInsertFunction(funcName, funcTy);
             toCompileFunctions_.insert(vfun);
+
+            unsigned& index = vi.m2iMap[methodDescr];
             if (!index) {
               index = elements.size();
-              elements.push_back(vfun->getType());
-              init.resize(elements.size(), NULL);
+              elements.resize(index + 1, NULL);
+              init.resize(index + 1, NULL);
             }
+            elements[index] = vfun->getType();
             init[index] = vfun;
           }
         }






More information about the llvm-commits mailing list