public HandleRefTypeMap(TypedefNameDecl td, BindingContext ctx, TypeMapDatabase dataBase) { Context = ctx; Type = td.Type; TypeMapDatabase = dataBase; InjectedType = new TagType(new Class( ) { Name = td.Name, Namespace = td.Namespace }); }
public Driver(DriverOptions options, IDiagnosticConsumer diagnostics) { Options = options; Diagnostics = diagnostics; Project = new Project(); ASTContext = new ASTContext(); Symbols = new SymbolContext(); TypeDatabase = new TypeMapDatabase(); TranslationUnitPasses = new PassBuilder <TranslationUnitPass>(this); GeneratorOutputPasses = new PassBuilder <GeneratorOutputPass>(this); }
public Driver(DriverOptions options, IDiagnosticConsumer diagnostics) { Options = options; Diagnostics = diagnostics; Parser = new Parser(Options); Parser.OnHeaderParsed += OnFileParsed; Parser.OnLibraryParsed += OnFileParsed; TypeDatabase = new TypeMapDatabase(); TranslationUnitPasses = new PassBuilder <TranslationUnitPass>(this); GeneratorOutputPasses = new PassBuilder <GeneratorOutputPass>(this); }
public BindingContext(DriverOptions options, ParserOptions parserOptions = null) { Options = options; ParserOptions = parserOptions; Symbols = new SymbolContext(); TypeMaps = new TypeMapDatabase(); TranslationUnitPasses = new PassBuilder <TranslationUnitPass>(this); GeneratorOutputPasses = new PassBuilder <GeneratorOutputPass>(this); }
public BindingContext(DriverOptions options, ParserOptions parserOptions = null) { Options = options; ParserOptions = parserOptions; Symbols = new SymbolContext(); Delegates = new Dictionary <Function, DelegatesPass.DelegateDefinition>(); TypeMaps = new TypeMapDatabase(); TranslationUnitPasses = new PassBuilder <TranslationUnitPass>(this); GeneratorOutputPasses = new PassBuilder <GeneratorOutputPass>(this); }
public BindingContext(IDiagnostics diagnostics, DriverOptions options, ParserOptions parserOptions = null) { Options = options; Diagnostics = diagnostics; ParserOptions = parserOptions; Symbols = new SymbolContext(); Delegates = new Dictionary <Function, DelegatesPass.DelegateDefinition>(); TypeDatabase = new TypeMapDatabase(); TypeDatabase.SetupTypeMaps(Options.GeneratorKind); TranslationUnitPasses = new PassBuilder <TranslationUnitPass>(this); GeneratorOutputPasses = new PassBuilder <GeneratorOutputPass>(this); }
public bool FindTypeMap(CppSharp.AST.Type type, out TypePrinterResult result) { result = null; if (!ResolveTypeMaps) { return(false); } TypeMap typeMap; if (!TypeMapDatabase.FindTypeMap(type, out typeMap) || typeMap.IsIgnored) { return(false); } var typePrinterContext = new TypePrinterContext { Type = type, Kind = Kind, MarshalKind = MarshalKind }; var typePrinter = new CppTypePrinter(Context) { PrintFlavorKind = PrintFlavorKind, ScopeKind = ScopeKind, PrintTypeQualifiers = PrintTypeQualifiers, PrintTypeModifiers = PrintTypeModifiers, ResolveTypeMaps = false }; typePrinter.PushContext(ContextKind); var typeName = typeMap.CppSignatureType(typePrinterContext).Visit(typePrinter); result = new TypePrinterResult(typeName) { TypeMap = typeMap }; return(true); }
public override TypePrinterResult VisitTagType(TagType tag, TypeQualifiers quals) { TypeMap typeMap = null; if (TypeMapDatabase.FindTypeMap(tag, out typeMap)) { var typePrinterContext = new TypePrinterContext { Type = tag }; return(typeMap.CLISignatureType(typePrinterContext).ToString()); } Declaration decl = tag.Declaration; if (decl == null) { return(string.Empty); } return(VisitDeclaration(decl, quals)); }
public override TypePrinterResult VisitTemplateSpecializationType( TemplateSpecializationType template, TypeQualifiers quals) { var decl = template.Template.TemplatedDecl; if (decl == null) { return(string.Empty); } TypeMap typeMap = null; if (TypeMapDatabase.FindTypeMap(template, out typeMap) && !typeMap.IsIgnored) { var typePrinterContext = new TypePrinterContext { Type = template }; return(typeMap.CLISignatureType(typePrinterContext).ToString()); } return(decl.Name); }
public override TypePrinterResult VisitTagType(TagType tag, TypeQualifiers quals) { TypeMap typeMap; if (ResolveTypeMaps && TypeMapDatabase.FindTypeMap(tag, out typeMap) && !typeMap.IsIgnored) { var typePrinterContext = new TypePrinterContext { Type = tag }; var type = typeMap.CppSignatureType(typePrinterContext).ToString(); return(new TypePrinterResult(type) { TypeMap = typeMap }); } var qual = GetStringQuals(quals); return($"{qual}{tag.Declaration.Visit(this)}"); }
public static void FindEvents(this PassBuilder builder, TypeMapDatabase database) { var pass = new FindEventsPass(database); builder.AddPass(pass); }