示例#1
0
        public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context)
        {
            var s     = context.GetRValueState();
            var addrs = AH.MakeExprDotName(s, "addrs", "Armada_Addrs");
            var addr  = AH.MakeExprDotName(addrs, name, new PointerType(ty));

            var h = context.GetRValueHeap();

            var valid = AH.GetInvocationOfValidPointer(h, addr, ty);

            if (valid == null)
            {
                context.Fail(tok, "Type {ty} is currently not supported in the heap");
                return(null);
            }
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint(valid);

            var val = AH.GetInvocationOfDereferencePointer(h, addr, ty);

            if (val == null)
            {
                context.Fail(tok, "Type {ty} is currently not supported in the heap");
            }
            return(new ArmadaRValue(crashAvoidance, val));
        }
示例#2
0
        public override ArmadaRValue GetRValue(IToken tok, ResolutionContext context)
        {
            var addr  = $"({context.GetRValueState()}).addrs.{name}";
            var h     = context.GetRValueHeap();
            var valid = AH.GetInvocationOfValidPointer(h, addr, ty);

            if (valid == null)
            {
                context.Fail(tok, $"Type {ty} is currently not supported in the heap");
                return(null);
            }
            var crashAvoidance = new UndefinedBehaviorAvoidanceConstraint(valid);

            var val = AH.GetInvocationOfDereferencePointer(h, addr, ty);

            if (val == null)
            {
                context.Fail(tok, $"Type {ty} is currently not supported in the heap");
            }
            return(new ArmadaRValue(crashAvoidance, val));
        }