From: bdemsky Date: Mon, 1 Mar 2004 05:40:13 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=commitdiff_plain;h=a8d1f83099dff307e67a60a7e40074e22c1ed128;hp=3c506efa4061b38ca6a709d69f04f315534ce634 *** empty log message *** --- diff --git a/Repair/RepairCompiler/MCC/IR/SemanticChecker.java b/Repair/RepairCompiler/MCC/IR/SemanticChecker.java index e94f7bd..46e0105 100755 --- a/Repair/RepairCompiler/MCC/IR/SemanticChecker.java +++ b/Repair/RepairCompiler/MCC/IR/SemanticChecker.java @@ -859,7 +859,7 @@ public class SemanticChecker { } 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) { @@ -870,7 +870,7 @@ public class SemanticChecker { 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; - TypeDescriptor subtype = type.getSubType(); + TypeDescriptor subtype = type.getSuperType(); Iterator fields = type.getFields(); while (fields.hasNext()) { @@ -1038,7 +1038,7 @@ public class SemanticChecker { } /* 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 diff --git a/Repair/RepairCompiler/MCC/IR/StructureTypeDescriptor.java b/Repair/RepairCompiler/MCC/IR/StructureTypeDescriptor.java index 222c6c1..32d38f5 100755 --- a/Repair/RepairCompiler/MCC/IR/StructureTypeDescriptor.java +++ b/Repair/RepairCompiler/MCC/IR/StructureTypeDescriptor.java @@ -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(); + int idnum; + static int counter=0; + + public int getId() { + return idnum; + } public StructureTypeDescriptor(String name) { super(name); + idnum=counter++; } public TypeDescriptor getGenerateType() { @@ -34,7 +41,10 @@ public class StructureTypeDescriptor extends TypeDescriptor { } 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); @@ -117,11 +127,11 @@ public class StructureTypeDescriptor extends TypeDescriptor { labels.put(ld.getSymbol(), ld); } - public TypeDescriptor getSubType() { + public TypeDescriptor getSuperType() { return subtype; } - public void setSubType(TypeDescriptor td) { + public void setSuperType(TypeDescriptor td) { subtype = td; }