Ejemplo n.º 1
0
 internal DependentVectorType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DependentVector)
 {
     _elementType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.ElementType));
     _sizeExpr    = new Lazy <Expr>(() => TranslationUnit.GetOrCreate <Expr>(Handle.SizeExpr));
 }
Ejemplo n.º 2
0
 internal MaterializeTemporaryExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_MaterializeTemporaryExpr)
 {
     _lifetimeExtendedTemporaryDecl = new Lazy <LifetimeExtendedTemporaryDecl>(() => TranslationUnit.GetOrCreate <LifetimeExtendedTemporaryDecl>(Handle.Referenced));
 }
Ejemplo n.º 3
0
 internal DependentAddressSpaceType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_DependentAddressSpace)
 {
     _addrSpaceExpr = new Lazy <Expr>(() => TranslationUnit.GetOrCreate <Expr>(Handle.AddrSpaceExpr));
 }
Ejemplo n.º 4
0
 private protected FunctionType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _returnType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.ResultType));
 }
Ejemplo n.º 5
0
 internal CompoundLiteralExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CompoundLiteralExpr, CX_StmtClass.CX_StmtClass_CompoundLiteralExpr)
 {
     Debug.Assert(NumChildren is 1);
     _typeSourceinfoType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.TypeOperand));
 }
Ejemplo n.º 6
0
 private protected UnaryTransformType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _baseType       = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.BaseType));
     _underlyingType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.UnderlyingType));
 }
Ejemplo n.º 7
0
 internal ElaboratedType(CXType handle) : base(handle, CXTypeKind.CXType_Elaborated, CX_TypeClass.CX_TypeClass_Elaborated)
 {
     _namedType    = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.NamedType));
     _ownedTagDecl = new Lazy <TagDecl>(() => TranslationUnit.GetOrCreate <TagDecl>(Handle.OwnedTagDecl));
 }
Ejemplo n.º 8
0
 internal ObjCCompatibleAliasDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_ObjCCompatibleAlias)
 {
     _classInterface = new Lazy <ObjCInterfaceDecl>(() => TranslationUnit.GetOrCreate <ObjCInterfaceDecl>(Handle.GetSubDecl(0)));
 }
Ejemplo n.º 9
0
 internal IncompleteArrayType(CXType handle) : base(handle, CXTypeKind.CXType_IncompleteArray, CX_TypeClass.CX_TypeClass_IncompleteArray)
 {
     _desugaredType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.Desugar()));
 }
Ejemplo n.º 10
0
 internal PackExpansionType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_PackExpansion)
 {
     _desugaredType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.Desugar()));
 }
Ejemplo n.º 11
0
 internal ParmVarDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ParmDecl, CX_DeclKind.CX_DeclKind_ParmVar)
 {
     _defaultArg               = new Lazy <Expr>(() => TranslationUnit.GetOrCreate <Expr>(Handle.DefaultArg));
     _originalType             = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.OriginalType));
     _uninstantiatedDefaultArg = new Lazy <Expr>(() => TranslationUnit.GetOrCreate <Expr>(Handle.UninstantiatedDefaultArg));
 }
Ejemplo n.º 12
0
 internal NamespaceAliasDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_NamespaceAlias, CX_DeclKind.CX_DeclKind_NamespaceAlias)
 {
     _aliasedNamespace = new Lazy <NamedDecl>(() => TranslationUnit.GetOrCreate <NamedDecl>(Handle.GetSubDecl(0)));
     _namespace        = new Lazy <NamespaceDecl>(() => TranslationUnit.GetOrCreate <NamespaceDecl>(Handle.GetSubDecl(1)));
 }
Ejemplo n.º 13
0
 internal ComplexType(CXType handle) : base(handle, CXTypeKind.CXType_Complex, CX_TypeClass.CX_TypeClass_Complex)
 {
     _desugaredType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.Desugar()));
     _elementType   = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.ElementType));
 }
Ejemplo n.º 14
0
 internal AddrLabelExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_AddrLabelExpr, CX_StmtClass.CX_StmtClass_AddrLabelExpr)
 {
     _label = new Lazy <LabelDecl>(() => TranslationUnit.GetOrCreate <LabelDecl>(Handle.Referenced));
 }
Ejemplo n.º 15
0
 internal CXXDeleteExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXDeleteExpr, CX_StmtClass.CX_StmtClass_CXXDeleteExpr)
 {
     _argument       = new Lazy <Expr>(() => TranslationUnit.GetOrCreate <Expr>(Handle.SubExpr));
     _operatorDelete = new Lazy <FunctionDecl>(() => TranslationUnit.GetOrCreate <FunctionDecl>(Handle.Referenced));
 }
Ejemplo n.º 16
0
 internal LabelDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Label)
 {
     _stmt = new Lazy <LabelStmt>(() => TranslationUnit.GetOrCreate <LabelStmt>(Handle.GetExpr(0)));
 }
Ejemplo n.º 17
0
        public static int Run(InvocationContext context)
        {
            var additionalArgs         = context.ParseResult.ValueForOption <string[]>("additional");
            var configSwitches         = context.ParseResult.ValueForOption <string[]>("config");
            var defineMacros           = context.ParseResult.ValueForOption <string[]>("define-macro");
            var excludedNames          = context.ParseResult.ValueForOption <string[]>("exclude");
            var files                  = context.ParseResult.ValueForOption <string[]>("file");
            var fileDirectory          = context.ParseResult.ValueForOption <string>("file-directory");
            var headerFile             = context.ParseResult.ValueForOption <string>("headerFile");
            var includeDirectories     = context.ParseResult.ValueForOption <string[]>("include-directory");
            var language               = context.ParseResult.ValueForOption <string>("language");
            var libraryPath            = context.ParseResult.ValueForOption <string>("libraryPath");
            var methodClassName        = context.ParseResult.ValueForOption <string>("methodClassName");
            var methodPrefixToStrip    = context.ParseResult.ValueForOption <string>("prefixStrip");
            var namespaceName          = context.ParseResult.ValueForOption <string>("namespace");
            var outputLocation         = context.ParseResult.ValueForOption <string>("output");
            var remappedNameValuePairs = context.ParseResult.ValueForOption <string[]>("remap");
            var std = context.ParseResult.ValueForOption <string>("std");
            var testOutputLocation            = context.ParseResult.ValueForOption <string>("test-output");
            var traversalNames                = context.ParseResult.ValueForOption <string[]>("traverse");
            var withAttributeNameValuePairs   = context.ParseResult.ValueForOption <string[]>("with-attribute");
            var withCallConvNameValuePairs    = context.ParseResult.ValueForOption <string[]>("with-callconv");
            var withLibraryPathNameValuePairs = context.ParseResult.ValueForOption <string[]>("with-librarypath");
            var withSetLastErrors             = context.ParseResult.ValueForOption <string[]>("with-setlasterror");
            var withTypeNameValuePairs        = context.ParseResult.ValueForOption <string[]>("with-type");
            var withUsingNameValuePairs       = context.ParseResult.ValueForOption <string[]>("with-using");

            var errorList = new List <string>();

            if (!files.Any())
            {
                errorList.Add("Error: No input C/C++ files provided. Use --file or -f");
            }

            if (string.IsNullOrWhiteSpace(namespaceName))
            {
                errorList.Add("Error: No namespace provided. Use --namespace or -n");
            }

            if (string.IsNullOrWhiteSpace(outputLocation))
            {
                errorList.Add("Error: No output file location provided. Use --output or -o");
            }

            ParseKeyValuePairs(remappedNameValuePairs, errorList, out Dictionary <string, string> remappedNames);
            ParseKeyValuePairs(withAttributeNameValuePairs, errorList, out Dictionary <string, IReadOnlyList <string> > withAttributes);
            ParseKeyValuePairs(withCallConvNameValuePairs, errorList, out Dictionary <string, string> withCallConvs);
            ParseKeyValuePairs(withLibraryPathNameValuePairs, errorList, out Dictionary <string, string> withLibraryPath);
            ParseKeyValuePairs(withTypeNameValuePairs, errorList, out Dictionary <string, string> withTypes);
            ParseKeyValuePairs(withUsingNameValuePairs, errorList, out Dictionary <string, IReadOnlyList <string> > withUsings);

            var configOptions = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? PInvokeGeneratorConfigurationOptions.None : PInvokeGeneratorConfigurationOptions.GenerateUnixTypes;

            foreach (var configSwitch in configSwitches)
            {
                switch (configSwitch)
                {
                case "compatible-codegen":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode;
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GeneratePreviewCode;
                    break;
                }

                case "default-remappings":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.NoDefaultRemappings;
                    break;
                }

                case "exclude-com-proxies":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.ExcludeComProxies;
                    break;
                }

                case "exclude-empty-records":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.ExcludeEmptyRecords;
                    break;
                }

                case "exclude-enum-operators":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.ExcludeEnumOperators;
                    break;
                }

                case "explicit-vtbls":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls;
                    break;
                }

                case "generate-aggressive-inlining":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateAggressiveInlining;
                    break;
                }

                case "generate-macro-bindings":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateMacroBindings;
                    break;
                }

                case "generate-tests-nunit":
                {
                    if (string.IsNullOrWhiteSpace(testOutputLocation))
                    {
                        errorList.Add("Error: No test output file location provided. Use --test-output or -to");
                    }

                    if (configOptions.HasFlag(PInvokeGeneratorConfigurationOptions.GenerateTestsXUnit))
                    {
                        errorList.Add("Cannot generate both NUnit and XUnit tests.");
                    }
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateTestsNUnit;
                    break;
                }

                case "generate-tests-xunit":
                {
                    if (string.IsNullOrWhiteSpace(testOutputLocation))
                    {
                        errorList.Add("Error: No test output file location provided. Use --test-output or -to");
                    }

                    if (configOptions.HasFlag(PInvokeGeneratorConfigurationOptions.GenerateTestsNUnit))
                    {
                        errorList.Add("Cannot generate both NUnit and XUnit tests.");
                    }
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateTestsXUnit;
                    break;
                }

                case "implicit-vtbls":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GenerateExplicitVtbls;
                    break;
                }

                case "latest-codegen":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode;
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GeneratePreviewCode;
                    break;
                }

                case "log-exclusions":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.LogExclusions;
                    break;
                }

                case "log-visited-files":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.LogVisitedFiles;
                    break;
                }

                case "multi-file":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateMultipleFiles;
                    break;
                }

                case "no-default-remappings":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.NoDefaultRemappings;
                    break;
                }

                case "preview-codegen":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode;
                    configOptions |= PInvokeGeneratorConfigurationOptions.GeneratePreviewCode;
                    break;
                }

                case "preview-codegen-nint":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode;
                    configOptions |= PInvokeGeneratorConfigurationOptions.GeneratePreviewCodeNint;
                    break;
                }

                case "preview-codegen-fnptr":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode;
                    configOptions |= PInvokeGeneratorConfigurationOptions.GeneratePreviewCodeFnptr;
                    break;
                }

                case "single-file":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GenerateMultipleFiles;
                    break;
                }

                case "unix-types":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateUnixTypes;
                    break;
                }

                case "windows-types":
                {
                    configOptions &= ~PInvokeGeneratorConfigurationOptions.GenerateUnixTypes;
                    break;
                }

                case "exclude-funcs-with-body":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.ExcludeFunctionsWithBody;
                    break;
                }

                case "log-potential-typedef-remappings":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.LogPotentialTypedefRemappings;
                    break;
                }

                case "exclude-anonymous-field-helpers":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.ExcludeAnonymousFieldHelpers;
                    break;
                }

                case "generate-cpp-attributes":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateCppAttributes;
                    break;
                }

                case "generate-native-inheritance-attribute":
                {
                    configOptions |= PInvokeGeneratorConfigurationOptions.GenerateNativeInheritanceAttribute;
                    break;
                }

                default:
                {
                    errorList.Add($"Error: Unrecognized config switch: {configSwitch}.");
                    break;
                }
                }
            }

            if (!string.IsNullOrWhiteSpace(testOutputLocation) && !configOptions.HasFlag(PInvokeGeneratorConfigurationOptions.GenerateTestsNUnit) && !configOptions.HasFlag(PInvokeGeneratorConfigurationOptions.GenerateTestsXUnit))
            {
                errorList.Add("Error: No test format provided. Use --config generate-tests-nunit or --config generate-tests-xunit");
            }

            if (errorList.Any())
            {
                foreach (var error in errorList)
                {
                    context.Console.Error.Write(error);
                    context.Console.Error.Write(Environment.NewLine);
                }
                context.Console.Error.Write(Environment.NewLine);

                new HelpBuilder(context.Console).Write(s_rootCommand);
                return(-1);
            }

            var clangCommandLineArgs = new string[]
            {
                $"--language={language}",               // Treat subsequent input files as having type <language>
                $"--std={std}",                         // Language standard to compile for
                "-Wno-pragma-once-outside-header"       // We are processing files which may be header files
            };

            clangCommandLineArgs = clangCommandLineArgs.Concat(includeDirectories.Select(x => "--include-directory=" + x)).ToArray();
            clangCommandLineArgs = clangCommandLineArgs.Concat(defineMacros.Select(x => "--define-macro=" + x)).ToArray();
            clangCommandLineArgs = clangCommandLineArgs.Concat(additionalArgs).ToArray();

            var translationFlags = CXTranslationUnit_Flags.CXTranslationUnit_None;

            translationFlags |= CXTranslationUnit_Flags.CXTranslationUnit_IncludeAttributedTypes;               // Include attributed types in CXType
            translationFlags |= CXTranslationUnit_Flags.CXTranslationUnit_VisitImplicitAttributes;              // Implicit attributes should be visited

            var config = new PInvokeGeneratorConfiguration(libraryPath, namespaceName, outputLocation, testOutputLocation, configOptions, excludedNames, headerFile, methodClassName, methodPrefixToStrip, remappedNames, traversalNames, withAttributes, withCallConvs, withLibraryPath, withSetLastErrors, withTypes, withUsings);

            if (config.GenerateMacroBindings)
            {
                translationFlags |= CXTranslationUnit_Flags.CXTranslationUnit_DetailedPreprocessingRecord;
            }

            int exitCode = 0;

            using (var pinvokeGenerator = new PInvokeGenerator(config))
            {
                foreach (var file in files)
                {
                    var filePath = Path.Combine(fileDirectory, file);

                    var translationUnitError = CXTranslationUnit.TryParse(pinvokeGenerator.IndexHandle, filePath, clangCommandLineArgs, Array.Empty <CXUnsavedFile>(), translationFlags, out CXTranslationUnit handle);
                    var skipProcessing       = false;

                    if (translationUnitError != CXErrorCode.CXError_Success)
                    {
                        Console.WriteLine($"Error: Parsing failed for '{filePath}' due to '{translationUnitError}'.");
                        skipProcessing = true;
                    }
                    else if (handle.NumDiagnostics != 0)
                    {
                        Console.WriteLine($"Diagnostics for '{filePath}':");

                        for (uint i = 0; i < handle.NumDiagnostics; ++i)
                        {
                            using var diagnostic = handle.GetDiagnostic(i);

                            Console.Write("    ");
                            Console.WriteLine(diagnostic.Format(CXDiagnostic.DefaultDisplayOptions).ToString());

                            skipProcessing |= (diagnostic.Severity == CXDiagnosticSeverity.CXDiagnostic_Error);
                            skipProcessing |= (diagnostic.Severity == CXDiagnosticSeverity.CXDiagnostic_Fatal);
                        }
                    }

                    if (skipProcessing)
                    {
                        Console.WriteLine($"Skipping '{filePath}' due to one or more errors listed above.");
                        Console.WriteLine();

                        exitCode = -1;
                        continue;
                    }

                    try
                    {
                        using var translationUnit = TranslationUnit.GetOrCreate(handle);
                        Console.WriteLine($"Processing '{filePath}'");

                        pinvokeGenerator.GenerateBindings(translationUnit, filePath, clangCommandLineArgs, translationFlags);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }

                if (pinvokeGenerator.Diagnostics.Count != 0)
                {
                    Console.WriteLine("Diagnostics for binding generation:");

                    foreach (var diagnostic in pinvokeGenerator.Diagnostics)
                    {
                        Console.Write("    ");
                        Console.WriteLine(diagnostic);

                        if (diagnostic.Level == DiagnosticLevel.Warning)
                        {
                            if (exitCode >= 0)
                            {
                                exitCode++;
                            }
                        }
                        else if (diagnostic.Level == DiagnosticLevel.Error)
                        {
                            if (exitCode >= 0)
                            {
                                exitCode = -1;
                            }
                            else
                            {
                                exitCode--;
                            }
                        }
                    }
                }
            }

            return(exitCode);
        }
Ejemplo n.º 18
0
 private protected TagType(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind)
 {
     _decl = new Lazy <TagDecl>(() => TranslationUnit.GetOrCreate <TagDecl>(Handle.Declaration));
 }
Ejemplo n.º 19
0
 internal SizeOfPackExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SizeOfPackExpr, CX_StmtClass.CX_StmtClass_SizeOfPackExpr)
 {
     _pack = new Lazy <NamedDecl>(() => TranslationUnit.GetOrCreate <NamedDecl>(Handle.Referenced));
 }
Ejemplo n.º 20
0
 internal DeclRefExpr(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind)
 {
     _decl = new Lazy <ValueDecl>(() => TranslationUnit.GetOrCreate <ValueDecl>(Handle.Referenced));
 }
Ejemplo n.º 21
0
 internal GotoStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_GotoStmt, CX_StmtClass.CX_StmtClass_GotoStmt)
 {
     _label = new Lazy <LabelDecl>(() => TranslationUnit.GetOrCreate <LabelDecl>(Handle.Referenced));
 }
Ejemplo n.º 22
0
 internal ObjCBoxedExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ObjCBoxedExpr)
 {
     Debug.Assert(NumChildren is 1);
     _boxingMethod = new Lazy <ObjCMethodDecl>(() => TranslationUnit.GetOrCreate <ObjCMethodDecl>(Handle.Referenced));
 }
Ejemplo n.º 23
0
 private protected ReferenceType(CXType handle, CXTypeKind expectedKind) : base(handle, expectedKind)
 {
     _pointeeType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.PointeeType));
 }
Ejemplo n.º 24
0
 internal ObjCSubscriptRefExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ObjCSubscriptRefExpr)
 {
     Debug.Assert(NumChildren is 2);
     _atIndexMethodDecl = new Lazy <ObjCMethodDecl>(() => TranslationUnit.GetOrCreate <ObjCMethodDecl>(Handle.Referenced));
 }
Ejemplo n.º 25
0
 internal TemplateTypeParmType(CXType handle) : base(handle, CXTypeKind.CXType_Unexposed, CX_TypeClass.CX_TypeClass_TemplateTypeParm)
 {
     _decl = new Lazy <TemplateTypeParmDecl>(() => TranslationUnit.GetOrCreate <TemplateTypeParmDecl>(Handle.Declaration));
 }
Ejemplo n.º 26
0
 internal StaticAssertDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_StaticAssert, CX_DeclKind.CX_DeclKind_StaticAssert)
 {
     _assertExpr = new Lazy <Expr>(() => TranslationUnit.GetOrCreate <Expr>(Handle.GetExpr(0)));
     _message    = new Lazy <StringLiteral>(() => TranslationUnit.GetOrCreate <StringLiteral>(Handle.GetExpr(1)));
 }
Ejemplo n.º 27
0
 internal CXXScalarValueInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXScalarValueInitExpr)
 {
     Debug.Assert(NumChildren is 0);
     _typeSourceInfoType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.TypeOperand));
 }
Ejemplo n.º 28
0
 internal UnaryOperator(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnaryOperator, CX_StmtClass.CX_StmtClass_UnaryOperator)
 {
     _subExpr = new Lazy <Expr>(() => TranslationUnit.GetOrCreate <Expr>(Handle.SubExpr));
 }
Ejemplo n.º 29
0
 private protected ClassTemplateSpecializationDecl(CXCursor handle, CXCursorKind expectedKind) : base(handle, expectedKind)
 {
     _specializedTemplate = new Lazy <ClassTemplateDecl>(() => TranslationUnit.GetOrCreate <ClassTemplateDecl>(Handle.SpecializedCursorTemplate));
 }
Ejemplo n.º 30
0
 private protected MatrixType(CXType handle, CXTypeKind expectedTypeKind, CX_TypeClass expectedTypeClass) : base(handle, expectedTypeKind, expectedTypeClass)
 {
     _desugaredType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.Desugar()));
     _elementType   = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(handle.ElementType));
 }