Completed support for generating C code.
[repair.git] / Repair / RepairCompiler / MCC / IR / SizeofFunction.java
index 3e053684025ae70ebac6076472dc19546564ccbe..71b1f228481d4cb45c0fa9a1cca5d8188c6fdf3a 100755 (executable)
@@ -37,7 +37,7 @@ public class SizeofFunction extends Expr {
         // is expand the guard of the rule and if its true then its 1 otherwise 0
 
         String destname = dest.getSafeSymbol();
-        cr.outputline("int " + destname + ";");
+        cr.addDeclaration("int", destname);
 
         // ok... destination is declared... we gotta expand this rule inplace... and instead of the inclusion we
         // set the destination in the guard ... otherwise maybe!
@@ -53,8 +53,10 @@ public class SizeofFunction extends Expr {
             String tempvar = (VarDescriptor.makeNew("tempvar")).getSafeSymbol();
 
             // this is to be safe about name overlap because int t = t; sets t to 0!
-            cr.outputline("int " + tempvar + " = " + domain.getSafeSymbol() + ";");
-            cr.outputline("int " + rulebinding.getSafeSymbol() + " = " + tempvar + ";");
+            cr.addDeclaration("int", tempvar);
+            cr.outputline(tempvar + " = " + domain.getSafeSymbol() + ";");
+            cr.addDeclaration("int", rulebinding.getSafeSymbol());
+            cr.outputline(rulebinding.getSafeSymbol() + " = " + tempvar + ";");
 
             /* pretty print! */
             cr.outputline("/* about to inbed relational function*/");