Ejemplo n.º 1
0
 public void VisitEnd(EndMethod method)
 {
     if (m_offset >= 0 && !m_hasBranch)
     {
         Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 2
0
 public void VisitEnd(EndMethod end)
 {
     if (m_numLocks == 1 && m_foundSingle && m_foundRet && !m_foundGuard)
     {
         Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty);
     }
 }
Ejemplo n.º 3
0
 public void VisitEnd(EndMethod method)
 {
     if (m_offset >= 0)
     {
         Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, m_details);
     }
 }
Ejemplo n.º 4
0
 public void VisitEnd(EndMethod method)
 {
     if (m_count > m_max)
     {
         Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 5
0
        public void VisitEnd(EndMethod end)
        {
            string details = string.Empty;

            if (m_isEmpty)
            {
                details += "Finalizer is empty." + Environment.NewLine;
            }

            if (m_doesThrow)
            {
                details += "Finalizer throws." + Environment.NewLine;
            }

            if (m_notDisposable)
            {
                details += "The type does not implement IDisposable." + Environment.NewLine;
            }

            details = details.Trim();
            if (details.Length > 0)
            {
                Log.DebugLine(this, "Details: {0}", details);
                Reporter.MethodFailed(end.Info.Method, CheckID, 0, details);
            }
        }
Ejemplo n.º 6
0
 public void VisitEnd(EndMethod end)
 {
     if (m_foundCtor && !m_foundLocale)
     {
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 7
0
 public void VisitEnd(EndMethod end)
 {
     if (m_needsCheck && m_failed)
     {
         m_details += end.Info.Method.ToString() + " ";
     }
 }
Ejemplo n.º 8
0
        public void VisitEnd(EndMethod end)
        {
            if (m_needsCheck)
            {
                string details = string.Empty;

                for (int i = m_types.Count - 1; i >= 1; --i)
                {
                    if (m_types[i] != null)
                    {
                        if (m_types[i].Count == 1)
                        {
                            details = string.Format("Argument '{0}' can be declared as {1}. {2}", m_info.Method.Parameters[i - 1].Name, m_types[i][0].FullName, details);
                        }
                        else if (m_types[i].Count > 0)
                        {
                            TypeReference type = DoConsolidateTypes(m_types[i]);
                            if (type != null && (type.FullName != m_formalTypes[i].FullName))
                            {
                                details = string.Format("Argument '{0}' can be declared as {1}. {2}", m_info.Method.Parameters[i - 1].Name, type.FullName, details);
                            }
                        }
                    }
                }

                if (details.Length > 0)
                {
                    Log.DebugLine(this, details);
                    Reporter.MethodFailed(end.Info.Method, CheckID, 0, details);
                }
            }
        }
Ejemplo n.º 9
0
        public void solve()
        {
            EquationSystem system = new EquationSystem(_limits);
            var            result = system.solve();

            StartMethod?.Invoke(new StartMethodObject(new PointS(result, solveFunction(result.X, result.Y)), _limits, _func));

            if (Utils.IsInteger(result))
            {
                _maxS = new PointS(result, solveFunction(result.X, result.Y));
            }
            else
            {
                List <int> list = new List <int>();
                if (!Utils.IsInteger(result.X))
                {
                    solve(_limits, new Equation(1, 0, ">=", Math.Ceiling(result.X)), new List <int>(list));
                    solve(_limits, new Equation(1, 0, "<=", Math.Floor(result.X)), new List <int>(list));
                }
                else
                {
                    solve(_limits, new Equation(0, 1, ">=", Math.Ceiling(result.Y)), new List <int>(list));
                    solve(_limits, new Equation(0, 1, "<=", Math.Floor(result.Y)), new List <int>(list));
                }
            }
            EndMethod.Invoke(this, new EndMethodObject(_maxS, true));
        }
Ejemplo n.º 10
0
 public void VisitEnd(EndMethod method)
 {
     if (m_offset >= 0 && m_numNew == 1 && m_numNext == 1)
     {
         Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 11
0
 public void VisitEnd(EndMethod end)
 {
     if (m_offset >= 0)
     {
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 12
0
 public void VisitEndMethod(EndMethod end)
 {
     if (m_offset >= 0)
     {
         Log.DebugLine(this, "identical operands at {0:X}", m_offset);
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 13
0
 public void VisitEnd(EndMethod end)
 {
     if (m_newOffsets.Count > m_setCount)
     {
         int offset = m_newOffsets.Count == 1 ? m_newOffsets[0] : 0;
         Reporter.MethodFailed(end.Info.Method, CheckID, offset, string.Empty);
     }
 }
Ejemplo n.º 14
0
 public void VisitEnd(EndMethod method)
 {
     if (m_offset >= 0)
     {
         Log.DebugLine(this, m_details);
         Reporter.MethodFailed(method.Info.Method, CheckID, m_offset, m_details);
     }
 }
Ejemplo n.º 15
0
 public void VisitEnd(EndMethod end)
 {
     if (m_offset >= 0)
     {
         m_details = "Calling: " + m_details;
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, m_details);
     }
 }
Ejemplo n.º 16
0
 public void VisitEnd(EndMethod end)
 {
     if (m_offset >= 0)
     {
         string details = "Method: " + m_bad;
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, details);
     }
 }
Ejemplo n.º 17
0
 public void VisitEnd(EndMethod end)
 {
     if (m_offset >= 0)
     {
         Log.DebugLine(this, "bad string at {0}", m_offset);
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 18
0
 public void VisitEnd(EndMethod end)
 {
     if (m_count > m_maxBranches)
     {
         Log.DebugLine(this, "found {0} branches", m_count);
         Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty);
     }
 }
Ejemplo n.º 19
0
 public void VisitEnd(EndMethod end)
 {
     if (m_needsCheck && m_offset >= 0)
     {
         m_details = "Words: " + m_details;
         Log.DebugLine(this, m_details);
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, m_details);
     }
 }
Ejemplo n.º 20
0
 public void VisitEnd(EndMethod end)
 {
     if (m_offset >= 0)
     {
         string details = "Arg: " + m_badArg;
         Log.DebugLine(this, details);
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty);
     }
 }
Ejemplo n.º 21
0
        public void VisitEnd(EndMethod end)
        {
            if (m_offset >= 0 && !m_foundEarlyReturn)
            {
                Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, m_details);
            }

            m_tracker = null;
        }
Ejemplo n.º 22
0
 public void VisitEnd(EndMethod end)
 {
     if (m_numUnboxes > m_maxUnboxes)
     {
         string details = string.Format("found {0} unbox instructions", m_numUnboxes);
         Log.DebugLine(this, details);
         Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, details);
     }
 }
Ejemplo n.º 23
0
        public void VisitMethodEnd(EndMethod end)
        {
            Unused.Value = end;

            if (m_equality != null)
            {
                m_equalities.Add(m_equality);
            }
        }
Ejemplo n.º 24
0
        public void VisitEnd(EndMethod end)
        {
            if (m_offset >= 0 && !m_foundTypeCheck)
            {
                Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty);
            }

            m_tracker = null;
        }
Ejemplo n.º 25
0
        public void VisitEnd(EndMethod end)
        {
            Unused.Value = end;

            if (m_needsCheck && m_missingBaseCall)
            {
                Reporter.MethodFailed(m_method, CheckID, 0, string.Empty);
            }
        }
Ejemplo n.º 26
0
        public void VisitEnd(EndMethod end)
        {
            if (m_args.Count > 0)
            {
                string details = "Args: " + string.Join(" ", m_args.ToArray());
                Log.DebugLine(this, "{0}", details);

                Reporter.MethodFailed(end.Info.Method, CheckID, 0, details);
            }
        }
Ejemplo n.º 27
0
        public void VisitEnd(EndMethod end)
        {
            if (m_offset < 0 && DoHasAssert(end.Info.Method.SecurityDeclarations))
            {
                m_offset = 0;
            }

            if (m_offset >= 0)
            {
                if (!DoHasDemand(end.Info.Type.SecurityDeclarations) && !DoHasDemand(end.Info.Method.SecurityDeclarations))
                {
                    Reporter.MethodFailed(end.Info.Method, CheckID, m_offset, string.Empty);
                }
            }
        }
Ejemplo n.º 28
0
 public void VisitEnd(EndMethod method)
 {
     if (m_wasStatic)
     {
         if (!m_hasLock)
         {
             Log.DebugLine(this, "has no lock");
             m_unlocked.Add(method.Info.Method);
         }
         if (m_setsState)
         {
             Log.DebugLine(this, "it's a static setter");
             m_setters.Add(method.Info.Method);
         }
     }
 }
Ejemplo n.º 29
0
        public void VisitEnd(EndMethod end)
        {
            Unused.Value = end;

            if (m_checkMethod)
            {
                foreach (string name in m_candidates)
                {
                    if (!m_bad.Contains(name))
                    {
                        Log.DebugLine(this, "   bad call: {0}", name);
                        m_bad.Add(name);
                    }
                }
            }
        }
Ejemplo n.º 30
0
        public void VisitEnd(EndMethod end)
        {
            if (m_needsCheck)
            {
                float ratio = end.Info.Method.Body.Instructions.Count;
                if (m_numVirtuals > 0)
                {
                    ratio /= m_numVirtuals;
                }

                if (ratio >= m_limit)
                {
                    Log.DebugLine(this, "numVirtuals: {0}", (int)m_numVirtuals);
                    Log.DebugLine(this, "ratio: {0}", ratio);
                    Reporter.MethodFailed(end.Info.Method, CheckID, 0, string.Empty);
                }
            }
        }