Browse Source

Add an option and checking for generation of deprecated declarations.

pull/1332/head
João Matos 5 years ago
parent
commit
2fb1376c4f
  1. 2
      src/CppParser/AST.cpp
  2. 7
      src/Generator/Options.cs
  3. 7
      src/Generator/Passes/CheckIgnoredDecls.cs

2
src/CppParser/AST.cpp

@ -272,7 +272,7 @@ Declaration::Declaration(const Declaration& rhs) @@ -272,7 +272,7 @@ Declaration::Declaration(const Declaration& rhs)
, isDependent(rhs.isDependent)
, isImplicit(rhs.isImplicit)
, isInvalid(rhs.isInvalid)
, isDeprecated(false)
, isDeprecated(rhs.isDeprecated)
, completeDeclaration(rhs.completeDeclaration)
, definitionOrder(rhs.definitionOrder)
, PreprocessedEntities(rhs.PreprocessedEntities)

7
src/Generator/Options.cs

@ -144,6 +144,13 @@ namespace CppSharp @@ -144,6 +144,13 @@ namespace CppSharp
/// </summary>
public bool GenerateDefaultValuesForArguments { get; set; }
/// <summary>
/// If set to false, then deprecated C/C++ declarations (those that have
/// the `__attribute__((deprecated))` or equivalent attribute) will not be
/// generated.
/// </summary>
public bool GenerateDeprecatedDeclarations { get; set; } = true;
public bool StripLibPrefix { get; set; }
/// <summary>

7
src/Generator/Passes/CheckIgnoredDecls.cs

@ -85,6 +85,13 @@ namespace CppSharp.Passes @@ -85,6 +85,13 @@ namespace CppSharp.Passes
return true;
}
if (decl.IsDeprecated && !Options.GenerateDeprecatedDeclarations)
{
Diagnostics.Debug("Decl '{0}' was ignored due to being deprecated", decl.Name);
decl.ExplicitlyIgnore();
return true;
}
if (!CheckDeclarationAccess(decl))
{
Diagnostics.Debug("Decl '{0}' was ignored due to invalid access",

Loading…
Cancel
Save