<commit_before>﻿
using System;

namespace CppSharp.AST
{
    public static class ASTUtils
    {
        public static bool CheckIgnoreFunction(Function function)
        {
            if (function.Ignore) return true;

            if (function is Method)
                return CheckIgnoreMethod(function as Method);

            return false;
        }

        public static bool CheckIgnoreMethod(Method method)
        {
            if (method.Ignore) return true;

            var isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0;

            var @class = method.Namespace as Class;
            if (@class != null && @class.IsValueType && isEmptyCtor)
                return true;

            if (method.IsMoveConstructor)
                return true;

            if (method.IsDestructor)
                return true;

            if (method.OperatorKind == CXXOperatorKind.Equal)
                return true;

            if (method.Access == AccessSpecifier.Private && !method.IsOverride)
                return true;

            return false;
        }

        public static bool CheckIgnoreField(Field field)
        {
            if (field.Access == AccessSpecifier.Private) 
                return true;

            return field.Ignore;<commit_msg>Ignore copy constructor if a base class don't has or has a private copy constructor<commit_after>﻿
using System;
using System.Linq;

namespace CppSharp.AST
{
    public static class ASTUtils
    {
        public static bool CheckIgnoreFunction(Function function)
        {
            if (function.Ignore) return true;

            if (function is Method)
                return CheckIgnoreMethod(function as Method);

            return false;
        }

        public static bool CheckIgnoreMethod(Method method)
        {
            if (method.Ignore) return true;

            var isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0;

            var @class = method.Namespace as Class;
            if (@class != null && @class.IsValueType && isEmptyCtor)
                return true;

            if (method.IsMoveConstructor)
                return true;

            if (method.IsDestructor)
                return true;

            if (method.OperatorKind == CXXOperatorKind.Equal)
                return true;

            if (method.Access == AccessSpecifier.Private && !method.IsOverride)
                return true;

            //Ignore copy constructor if a base class don't has or has a private copy constructor
            if (method.IsCopyConstructor)
            {
                var baseClass = @class;
                while (baseClass != null && baseClass.HasBaseClass)
                {
                    baseClass = baseClass.BaseClass;
                    var copyConstructor = baseClass.Methods.FirstOrDefault(m => m.IsCopyConstructor);
                    if (copyConstructor == null
                        || copyConstructor.Access == AccessSpecifier.Private
                        || copyConstructor.Ignore)
                        return true;
                }
            }

            return false;
        }

        public static bool CheckIgnoreField(Field field)
        {
            if (field.Access == AccessSpecifier.Private) 
                return true;

            return field.Ignore;
{'fraction_non_alphanumeric': 0.0710431654676259, 'fraction_numerical': 0.0005995203836930455, 'mean_word_length': 1.5629800307219661, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1432076', 'n_tokens_mistral': 807, 'n_tokens_neox': 747, 'n_words': 227}