From f02fa7b2abcd44b901ff117ce93b8de97d874275 Mon Sep 17 00:00:00 2001 From: marcos henrich Date: Wed, 2 Apr 2014 15:53:45 +0100 Subject: [PATCH] Added a macro expansion processing to ignore a translation unit. --- src/Generator/Passes/CheckMacrosPass.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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();