Example #1
0
        public CLITypeReference GetTypeReference(Declaration decl)
        {
            if (typeReferences.ContainsKey(decl))
            {
                return(typeReferences[decl]);
            }

            var translationUnit = decl.Namespace.TranslationUnit;

            if (ShouldIncludeTranslationUnit(translationUnit) && decl.IsGenerated && !IsBuiltinTypedef(decl))
            {
                var @ref = new CLITypeReference {
                    Declaration = decl
                };

                @ref.Include = new CInclude
                {
                    File            = DriverOptions.GetIncludePath(translationUnit),
                    TranslationUnit = translationUnit,
                    Kind            = translationUnit.IsGenerated ? CInclude.IncludeKind.Quoted : CInclude.IncludeKind.Angled
                };

                typeReferences.Add(decl, @ref);

                return(@ref);
            }

            return(null);
        }