Update virtual pointers for C++ code...Various fixes to emit extern declarations.
[repair.git] / Repair / RepairCompiler / MCC / IR / RepairGenerator.java
index 0f21555cc39f8cf04682f9f7c6ee3b2d2c75a19e..f1ff4d3e28963c6021edf4a041fe989d22f8c871 100755 (executable)
@@ -387,7 +387,22 @@ public class RepairGenerator {
        crhead.outputline("~"+name+"();");
         craux.outputline("#include \""+headername+"\"");
         craux.outputline("#include \"size.h\"");
-
+       if (Compiler.ALLOCATECPLUSPLUS) {
+           for(Iterator it=state.stTypes.descriptors();it.hasNext();) {
+               TypeDescriptor td=(TypeDescriptor)it.next();
+               if (td instanceof StructureTypeDescriptor) {
+                   if (((StructureTypeDescriptor)td).size()>0) {
+                       FieldDescriptor fd=((StructureTypeDescriptor)td).get(0);
+                       if (fd.getSymbol().startsWith("_vptr_")) {
+                           String vtable="_ZTV";
+                           vtable+=td.getSymbol().length();
+                           vtable+=td.getSymbol();
+                           craux.outputline("extern void * "+vtable+";");
+                       }
+                   }
+               }
+           }
+       }
         craux.outputline(name+"::"+name+"() {");
         craux.outputline("// creating hashtables ");