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);