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

Alkis Evlogimenos alkis at cs.uiuc.edu
Sun Mar 20 15:24:09 PST 2005



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.236 -> 1.237
---
Log message:

Fix case where abstract class implements an interface, but none of the current methods does so far.

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

 Compiler.cpp |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)


Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.236 llvm-java/lib/Compiler/Compiler.cpp:1.237
--- llvm-java/lib/Compiler/Compiler.cpp:1.236	Sat Mar 19 07:50:12 2005
+++ llvm-java/lib/Compiler/Compiler.cpp	Sun Mar 20 17:23:58 2005
@@ -627,11 +627,17 @@
       for (VTableInfo::Method2IndexMap::const_iterator
              i = interfaceVI.m2iMap.begin(), e = interfaceVI.m2iMap.end();
            i != e; ++i) {
-        assert(classVI.m2iMap.find(i->first) != classVI.m2iMap.end() &&
-               "Interface method not found in class definition!");
-        unsigned classMethodIdx = classVI.m2iMap.find(i->first)->second;
-        init[i->second] = cast<ConstantStruct>(
-          classVI.vtable->getInitializer())->getOperand(classMethodIdx);
+        if (!cf->isAbstract()) {
+          assert(classVI.m2iMap.find(i->first) != classVI.m2iMap.end() &&
+                 "Interface method not found in class definition!");
+          unsigned classMethodIdx = classVI.m2iMap.find(i->first)->second;
+          init[i->second] = cast<ConstantStruct>(
+            classVI.vtable->getInitializer())->getOperand(classMethodIdx);
+        }
+        else
+          init[i->second] =
+            llvm::Constant::getNullValue(
+              PointerType::get(VTableInfo::VTableTy));
       }
 
       llvm::Constant* vtable = ConstantStruct::get(init);






More information about the llvm-commits mailing list