diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs index b04381e5..7f4a6eb2 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs @@ -4699,16 +4699,21 @@ bool IsExcludedByName(Cursor cursor, ref uint isExcludedValue) } if (_config.IncludedNames.Count != 0 && !_config.IncludedNames.Contains(qualifiedName) - && !_config.IncludedNames.Contains(dottedQualifiedName) - && !_config.IncludedNames.Contains(qualifiedNameWithoutParameters) - && !_config.IncludedNames.Contains(dottedQualifiedNameWithoutParameters) - && !_config.IncludedNames.Contains(name)) + && !_config.IncludedNames.Contains(dottedQualifiedName) + && !_config.IncludedNames.Contains(qualifiedNameWithoutParameters) + && !_config.IncludedNames.Contains(dottedQualifiedNameWithoutParameters) + && !_config.IncludedNames.Contains(name)) { - if (_config.LogExclusions) + var semanticParentCursor = cursor.SemanticParentCursor; + + if ((semanticParentCursor is null) || IsExcluded(semanticParentCursor) || IsAlwaysIncluded(semanticParentCursor)) { - AddDiagnostic(DiagnosticLevel.Info, $"Excluded {kind} '{qualifiedName}' as it was not in the include list"); + if (_config.LogExclusions) + { + AddDiagnostic(DiagnosticLevel.Info, $"Excluded {kind} '{qualifiedName}' as it was not in the include list"); + } + return true; } - return true; } if ((isExcludedValue & 0b10) != 0)