diff --git a/src/CLI/Generator.cs b/src/CLI/Generator.cs index 5c6f72be..1489d2d5 100644 --- a/src/CLI/Generator.cs +++ b/src/CLI/Generator.cs @@ -150,7 +150,7 @@ namespace CppSharp } if (options.EnableExceptions) - parserOptions.AddArguments("-fcxx-exceptions"); + parserOptions.EnableExceptions = true; driverOptions.GenerateDebugOutput = options.Debug; driverOptions.CompileCode = options.Compile; diff --git a/src/Parser/ParserOptions.cs b/src/Parser/ParserOptions.cs index 41dffa66..6843aa15 100644 --- a/src/Parser/ParserOptions.cs +++ b/src/Parser/ParserOptions.cs @@ -86,6 +86,7 @@ namespace CppSharp.Parser TargetTriple.Contains("windows") || TargetTriple.Contains("msvc"); public bool EnableRTTI { get; set; } + public bool EnableExceptions { get; set; } public LanguageVersion? LanguageVersion { get; set; } public void BuildForSourceFile( @@ -367,6 +368,9 @@ namespace CppSharp.Parser if (!EnableRTTI) AddArguments("-fno-rtti"); + + if (EnableExceptions) + AddArguments("-fcxx-exceptions"); } public string BuiltinsDir