From 4aab472af5346f106b100fd7556e42fdd54320fa Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 19 Nov 2013 19:02:44 +0000 Subject: [PATCH] Fixed driver code to work with the new parser. --- src/Core/Parser/Parser.cs | 5 +++++ src/Generator/Driver.cs | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Core/Parser/Parser.cs b/src/Core/Parser/Parser.cs index cae84160..1ae28d0b 100644 --- a/src/Core/Parser/Parser.cs +++ b/src/Core/Parser/Parser.cs @@ -31,6 +31,11 @@ namespace CppSharp ASTContext = new ASTContext(); } + public ClangParser(ASTContext context) + { + ASTContext = context; + } + /// /// Parses a C++ source file to a translation unit. /// diff --git a/src/Generator/Driver.cs b/src/Generator/Driver.cs index a8ec9821..8f76dfd9 100644 --- a/src/Generator/Driver.cs +++ b/src/Generator/Driver.cs @@ -14,7 +14,7 @@ using System.IO; using Microsoft.CSharp; #if !OLD_PARSER -using Std; +using CppSharp.Parser; #endif namespace CppSharp @@ -38,6 +38,7 @@ namespace CppSharp Options = options; Diagnostics = diagnostics; Project = new Project(); + ASTContext = new ASTContext(); Symbols = new SymbolContext(); TypeDatabase = new TypeMapDatabase(); TranslationUnitPasses = new PassBuilder(this); @@ -120,12 +121,7 @@ namespace CppSharp var options = new ParserOptions { FileName = file.Path, -#if !OLD_PARSER - IncludeDirs = Options.IncludeDirs.ToStd(), - SystemIncludeDirs = Options.SystemIncludeDirs.ToStd(), - Defines = Options.Defines.ToStd(), - LibraryDirs = Options.LibraryDirs.ToStd(), -#else +#if OLD_PARSER IncludeDirs = Options.IncludeDirs, SystemIncludeDirs = Options.SystemIncludeDirs, Defines = Options.Defines, @@ -151,7 +147,11 @@ namespace CppSharp source.Options = BuildParseOptions(source); } - var parser = new ClangParser(); +#if !OLD_PARSER + var parser = new ClangParser(new Parser.AST.ASTContext()); +#else + var parser = new ClangParser(ASTContext); +#endif parser.SourceParsed += OnSourceFileParsed; parser.ParseProject(Project, Options);