mirror of https://github.com/mono/CppSharp.git
c-sharpdotnetmonobindingsbridgecclangcpluspluscppsharpglueinteropparserparsingpinvokeswigsyntax-treevisitorsxamarinxamarin-bindings
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
using System; |
|
using CppSharp.AST; |
|
using CppSharp.Utils; |
|
using CppSharp.Parser; |
|
|
|
namespace CppSharp.Generator.Tests |
|
{ |
|
public class ASTTestFixture |
|
{ |
|
protected Driver Driver; |
|
protected DriverOptions Options; |
|
protected ParserOptions ParserOptions; |
|
protected ASTContext AstContext; |
|
|
|
protected void ParseLibrary(params string[] files) |
|
{ |
|
Options = new DriverOptions(); |
|
ParserOptions = new ParserOptions(); |
|
|
|
var testsPath = GeneratorTest.GetTestsDirectory("Native"); |
|
ParserOptions.AddIncludeDirs(testsPath); |
|
|
|
var module = Options.AddModule("Test"); |
|
module.Headers.AddRange(files); |
|
|
|
Driver = new Driver(Options) |
|
{ |
|
ParserOptions = this.ParserOptions |
|
}; |
|
|
|
Driver.Setup(); |
|
Driver.BuildParseOptions(); |
|
if (!Driver.ParseCode()) |
|
throw new Exception("Error parsing the code"); |
|
|
|
AstContext = Driver.Context.ASTContext; |
|
} |
|
} |
|
}
|
|
|