Browse Source

Added support for the CS_IGNORE_GEN macro to CheckMacrosPass.

This is used for classes that we want to ignore only for generation but still want to process when they appear in type maps.
pull/169/head
triton 12 years ago
parent
commit
1dec71e8f3
  1. 15
      src/Generator/Passes/CheckMacrosPass.cs

15
src/Generator/Passes/CheckMacrosPass.cs

@ -13,6 +13,9 @@ namespace CppSharp.Passes @@ -13,6 +13,9 @@ namespace CppSharp.Passes
/// CS_IGNORE (declarations)
/// Used to ignore declarations from being processed.
///
/// CS_IGNORE_GEN (declarations)
/// Used to ignore declaration from being generated.
///
/// CS_VALUE_TYPE (classes and structs)
/// Used to flag that a class or struct is a value type.
///
@ -51,13 +54,23 @@ namespace CppSharp.Passes @@ -51,13 +54,23 @@ namespace CppSharp.Passes
var expansions = decl.PreprocessedEntities.OfType<MacroExpansion>();
CheckIgnoreMacros(decl, expansions);
return true;
}
void CheckIgnoreMacros(Declaration decl, IEnumerable<MacroExpansion> expansions)
{
if (expansions.Any(e => e.Text == Prefix + "_IGNORE" &&
e.Location != MacroLocation.ClassBody &&
e.Location != MacroLocation.FunctionBody &&
e.Location != MacroLocation.FunctionParameters))
decl.ExplicityIgnored = true;
return true;
if (expansions.Any(e => e.Text == Prefix + "_IGNORE_GEN" &&
e.Location != MacroLocation.ClassBody &&
e.Location != MacroLocation.FunctionBody &&
e.Location != MacroLocation.FunctionParameters))
decl.IsGenerated = false;
}
public override bool VisitClassDecl(Class @class)

Loading…
Cancel
Save