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

Alkis Evlogimenos alkis at cs.uiuc.edu
Tue Aug 3 00:52:22 PDT 2004



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.71 -> 1.72

---
Log message:

When the types of static calls do not match, cast to the correct type.


---
Diffs of the changes:  (+4 -2)

Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.71 llvm-java/lib/Compiler/Compiler.cpp:1.72
--- llvm-java/lib/Compiler/Compiler.cpp:1.71	Wed Jul 28 05:10:27 2004
+++ llvm-java/lib/Compiler/Compiler.cpp	Tue Aug  3 02:52:11 2004
@@ -844,9 +844,11 @@
             FunctionType* funcType =
                 cast<FunctionType>(getType(nameAndType->getDescriptor()));
             std::vector<Value*> params(funcType->getNumParams(), NULL);
-            for (unsigned i = funcType->getNumParams(); i > 0; ) {
+            for (unsigned i = 0, e = funcType->getNumParams(); i != e; ++i) {
                 Value* p = opStack_.top(); opStack_.pop();
-                params[--i] = p;
+                const Type* paramTy = funcType->getParamType(i);
+                params[i] = p->getType() == paramTy ? p :
+                    new CastInst(p, paramTy, TMP, getBBAt(bcI));
             }
 
             Function* function =





More information about the llvm-commits mailing list