diff --git a/src/Generator/Passes/CheckMacrosPass.cs b/src/Generator/Passes/CheckMacrosPass.cs index d4174b53..69d3f802 100644 --- a/src/Generator/Passes/CheckMacrosPass.cs +++ b/src/Generator/Passes/CheckMacrosPass.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CppSharp.AST; @@ -73,6 +74,19 @@ namespace CppSharp.Passes decl.IsGenerated = false; } + public override bool VisitTranslationUnit(TranslationUnit unit) + { + var expansions = unit.PreprocessedEntities.OfType(); + + if (expansions.Any(e => e.Text == Prefix + "_IGNORE_FILE")) + { + unit.IsGenerated = false; + unit.ExplicityIgnored = true; + } + + return base.VisitTranslationUnit(unit); + } + public override bool VisitClassDecl(Class @class) { var expansions = @class.PreprocessedEntities.OfType();