private void VisitPreprocessingDirective(PreprocessingDirective preprocessingDirective)
 {
     if (preprocessingDirective is InclusionDirective)
     {
     }
     else if (preprocessingDirective is MacroDefinitionRecord macroDefinitionRecord)
     {
         VisitMacroDefinitionRecord(macroDefinitionRecord);
     }
     else
     {
         AddDiagnostic(DiagnosticLevel.Error, $"Unsupported preprocessing directive: '{preprocessingDirective.CursorKind}'. Generated bindings may be incomplete.", preprocessingDirective);
     }
 }
Example #2
0
        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);
        }