Completed support for generating C code.
[repair.git] / Repair / RepairCompiler / MCC / IR / Sources.java
index 797644a12dd42383fcd3db436b755a2272e45aad..7072ba810938022d1f066dc4d21001428f380f0f 100755 (executable)
@@ -44,7 +44,8 @@ public class Sources {
        cr.pushSymbolTable(state.stGlobals);
        e.generate(cr, size);
        cr.popSymbolTable();
-       cr.outputline(td.getGenerateType().getSafeSymbol()+" "+vd.getSafeSymbol()+"=("+td.getGenerateType().getSafeSymbol()+") calloc(1,"+size.getSafeSymbol()+");");
+       cr.addDeclaration(td.getGenerateType().getSafeSymbol(), vd.getSafeSymbol());
+       cr.outputline(vd.getSafeSymbol()+"=("+td.getGenerateType().getSafeSymbol()+") calloc(1,"+size.getSafeSymbol()+");");
        cr.outputline("alloc((void *) "+vd.getSafeSymbol()+","+size.getSafeSymbol()+");");
        if (Compiler.ALLOCATECPLUSPLUS) {
            if (td instanceof StructureTypeDescriptor) {