*** empty log message ***
authorbdemsky <bdemsky>
Mon, 1 Mar 2004 05:40:13 +0000 (05:40 +0000)
committerbdemsky <bdemsky>
Mon, 1 Mar 2004 05:40:13 +0000 (05:40 +0000)
Repair/RepairCompiler/MCC/IR/SemanticChecker.java
Repair/RepairCompiler/MCC/IR/StructureTypeDescriptor.java

index e94f7bd124a3fe7ed823df21d28209f6b8a96ee7..46e010553860bcf954588f0e15cdad070f2c7193 100755 (executable)
@@ -859,7 +859,7 @@ public class SemanticChecker {
             } else if (t instanceof StructureTypeDescriptor) {
                 
                 StructureTypeDescriptor type = (StructureTypeDescriptor) t;
             } else if (t instanceof StructureTypeDescriptor) {
                 
                 StructureTypeDescriptor type = (StructureTypeDescriptor) t;
-                TypeDescriptor subtype = type.getSubType();
+                TypeDescriptor subtype = type.getSuperType();
 
                 // check that the subtype is valid
                 if (subtype instanceof MissingTypeDescriptor) {
 
                 // check that the subtype is valid
                 if (subtype instanceof MissingTypeDescriptor) {
@@ -870,7 +870,7 @@ public class SemanticChecker {
                         er.report(null, "Undefined subtype '" + subtype.getSymbol() + "'");
                         ok = false;
                     } else {
                         er.report(null, "Undefined subtype '" + subtype.getSymbol() + "'");
                         ok = false;
                     } else {
-                        type.setSubType(newtype);
+                        type.setSuperType(newtype);
                     }
                 }
 
                     }
                 }
 
@@ -939,7 +939,7 @@ public class SemanticChecker {
             } else if (t instanceof StructureTypeDescriptor) {
                 
                 StructureTypeDescriptor type = (StructureTypeDescriptor)t;
             } else if (t instanceof StructureTypeDescriptor) {
                 
                 StructureTypeDescriptor type = (StructureTypeDescriptor)t;
-                TypeDescriptor subtype = type.getSubType();
+                TypeDescriptor subtype = type.getSuperType();
                 Iterator fields = type.getFields();
 
                 while (fields.hasNext()) {
                 Iterator fields = type.getFields();
 
                 while (fields.hasNext()) {
@@ -1038,7 +1038,7 @@ public class SemanticChecker {
             }
 
             /* lookup the type to get the type descriptor */
             }
 
             /* lookup the type to get the type descriptor */
-            type.setSubType(lookupType(subtype, CREATE_MISSING));
+            type.setSuperType(lookupType(subtype, CREATE_MISSING));
         }
 
         // set the current type so that the recursive parses on the labels
         }
 
         // set the current type so that the recursive parses on the labels
index 222c6c1134fcb4d9eeeb25fe19791d39f4d51fb0..32d38f567c278164078551576072b11b68c0ed8b 100755 (executable)
@@ -15,9 +15,16 @@ public class StructureTypeDescriptor extends TypeDescriptor {
     Hashtable fields = new Hashtable(); /* fast lookups */
     Vector fieldlist = new Vector(); /* ordering information */
     Hashtable labels = new Hashtable();
     Hashtable fields = new Hashtable(); /* fast lookups */
     Vector fieldlist = new Vector(); /* ordering information */
     Hashtable labels = new Hashtable();
+    int idnum;
+    static int counter=0;
+
+    public int getId() {
+       return idnum;
+    }
 
     public StructureTypeDescriptor(String name) {
         super(name);
 
     public StructureTypeDescriptor(String name) {
         super(name);
+       idnum=counter++;
     }
 
     public TypeDescriptor getGenerateType() {
     }
 
     public TypeDescriptor getGenerateType() {
@@ -34,7 +41,10 @@ public class StructureTypeDescriptor extends TypeDescriptor {
     }
 
     public Expr getOffsetExpr(FieldDescriptor field) {
     }
 
     public Expr getOffsetExpr(FieldDescriptor field) {
-       
+       /* Fix sizeof calculations */
+       if ((field==null)&&(subtype!=null))
+           return subtype.getOFfsetExpr(field);
+
        boolean aligned=true;
         Expr size = new IntegerLiteralExpr(0);
         
        boolean aligned=true;
         Expr size = new IntegerLiteralExpr(0);
         
@@ -117,11 +127,11 @@ public class StructureTypeDescriptor extends TypeDescriptor {
         labels.put(ld.getSymbol(), ld);
     }
 
         labels.put(ld.getSymbol(), ld);
     }
 
-    public TypeDescriptor getSubType() {
+    public TypeDescriptor getSuperType() {
         return subtype;
     }
 
         return subtype;
     }
 
-    public void setSubType(TypeDescriptor td) {
+    public void setSuperType(TypeDescriptor td) {
         subtype = td;
     }
 
         subtype = td;
     }