private void VisitPreprocessedEntity(PreprocessedEntity preprocessedEntity) { if (!_config.GenerateMacroBindings) { return; } if (IsExcluded(preprocessedEntity)) { return; } if (preprocessedEntity is MacroExpansion) { // Not currently handling macro expansions } else if (preprocessedEntity is PreprocessingDirective preprocessingDirective) { VisitPreprocessingDirective(preprocessingDirective); } else { AddDiagnostic(DiagnosticLevel.Error, $"Unsupported preprocessed entity: '{preprocessedEntity.CursorKind}'. Generated bindings may be incomplete.", preprocessedEntity); } }
internal static new PreprocessedEntity Create(CXCursor handle) { PreprocessedEntity result; switch (handle.Kind) { case CXCursorKind.CXCursor_MacroDefinition: { result = new MacroDefinitionRecord(handle); break; } case CXCursorKind.CXCursor_MacroExpansion: { result = new MacroExpansion(handle); break; } case CXCursorKind.CXCursor_PreprocessingDirective: { result = new PreprocessingDirective(handle); break; } case CXCursorKind.CXCursor_InclusionDirective: { result = new InclusionDirective(handle); break; } default: { Debug.WriteLine($"Unhandled preprocessing kind: {handle.KindSpelling}."); Debugger.Break(); result = new PreprocessedEntity(handle, handle.Kind); break; } } return(result); }