X-Git-Url: http://plrg.eecs.uci.edu/git/?p=repair.git;a=blobdiff_plain;f=Repair%2FRepairCompiler%2FMCC%2FIR%2FSemanticChecker.java;h=62c12be2180cbd8cf087761474c84a0b62048a78;hp=108a88379b46e48f20e31bdcb3351b849073004a;hb=87862c69c1cb47c83a858f0b6e52d9c0bc25913f;hpb=a3c5c1cd64c83a127b8d89293794a67c5f530dbe diff --git a/Repair/RepairCompiler/MCC/IR/SemanticChecker.java b/Repair/RepairCompiler/MCC/IR/SemanticChecker.java index 108a883..62c12be 100755 --- a/Repair/RepairCompiler/MCC/IR/SemanticChecker.java +++ b/Repair/RepairCompiler/MCC/IR/SemanticChecker.java @@ -3,6 +3,7 @@ package MCC.IR; import java.util.*; import java.math.BigInteger; import MCC.State; +import MCC.Compiler; public class SemanticChecker { @@ -527,6 +528,7 @@ public class SemanticChecker { return null; } + rd.addUsage(RelationDescriptor.IMAGE); rq.setRelation(rd); vd1.setType(rd.getDomain().getType()); vd1.setSet(rd.getDomain()); @@ -994,6 +996,10 @@ public class SemanticChecker { public IRErrorReporter getErrorReporter() { return er; } public SymbolTable getSymbolTable() { return stGlobals; } }); + if (Compiler.REJECTLENGTH) { + analyze_length(indexbound); + } + if (indextype == null) { ok = false; @@ -1034,6 +1040,20 @@ public class SemanticChecker { return ok; } + private void analyze_length(Expr indexbound) { + Set descriptors=indexbound.getRequiredDescriptors(); + for(Iterator it=descriptors.iterator();it.hasNext();) { + Descriptor d=(Descriptor)it.next(); + if (d instanceof FieldDescriptor) { + state.noupdate.add(d); + } else if (d instanceof ArrayDescriptor) { + state.noupdate.add(d); + } else if (d instanceof VarDescriptor) { + state.noupdate.add(d); + } + } + } + private boolean parse_global(ParseNode pn) { if (!precheck(pn, "global")) { return false; @@ -1099,7 +1119,7 @@ public class SemanticChecker { dCurrentType = type; // parse the labels and fields - if (!parse_labelsandfields(pn.getChild("lf"))) { + if (pn.getChild("lf")!=null && !parse_labelsandfields(pn.getChild("lf"))) { ok = false; }