Browse Source

Ignored defaulted functions when generating C++ for symbols.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/913/head
Dimitar Dobrev 8 years ago
parent
commit
9294ea0978
  1. 5
      src/AST/Function.cs
  2. 1
      src/CppParser/AST.cpp
  3. 1
      src/CppParser/AST.h
  4. 10
      src/CppParser/Bindings/CLI/AST.cpp
  5. 6
      src/CppParser/Bindings/CLI/AST.h
  6. 19
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs
  7. 15
      src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs
  8. 19
      src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs
  9. 19
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs
  10. 15
      src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs
  11. 19
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs
  12. 19
      src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs
  13. 19
      src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs
  14. 1
      src/CppParser/Parser.cpp
  15. 10
      src/Generator/Passes/GenerateSymbolsPass.cs
  16. 1
      src/Parser/ASTConverter.cs

5
src/AST/Function.cs

@ -158,6 +158,10 @@ namespace CppSharp.AST @@ -158,6 +158,10 @@ namespace CppSharp.AST
IsVariadic = function.IsVariadic;
IsInline = function.IsInline;
IsPure = function.IsPure;
IsDeleted = function.IsDeleted;
IsDefaulted = function.IsDefaulted;
IsAmbiguous = function.IsAmbiguous;
FriendKind = function.FriendKind;
OperatorKind = function.OperatorKind;
CallingConvention = function.CallingConvention;
SynthKind = function.SynthKind;
@ -182,6 +186,7 @@ namespace CppSharp.AST @@ -182,6 +186,7 @@ namespace CppSharp.AST
public bool IsInline { get; set; }
public bool IsPure { get; set; }
public bool IsDeleted { get; set; }
public bool IsDefaulted { get; set; }
public bool IsAmbiguous { get; set; }
public FriendKind FriendKind { get; set; }
public CXXOperatorKind OperatorKind { get; set; }

1
src/CppParser/AST.cpp

@ -633,6 +633,7 @@ Function::Function() @@ -633,6 +633,7 @@ Function::Function()
, isInline(false)
, isPure(false)
, isDeleted(false)
, isDefaulted(false)
, friendKind(FriendKind::None)
, operatorKind(CXXOperatorKind::None)
, callingConvention(CallingConvention::Default)

1
src/CppParser/AST.h

@ -731,6 +731,7 @@ public: @@ -731,6 +731,7 @@ public:
bool isInline;
bool isPure;
bool isDeleted;
bool isDefaulted;
FriendKind friendKind;
CXXOperatorKind operatorKind;
std::string mangled;

10
src/CppParser/Bindings/CLI/AST.cpp

@ -3594,6 +3594,16 @@ void CppSharp::Parser::AST::Function::IsDeleted::set(bool value) @@ -3594,6 +3594,16 @@ void CppSharp::Parser::AST::Function::IsDeleted::set(bool value)
((::CppSharp::CppParser::AST::Function*)NativePtr)->isDeleted = value;
}
bool CppSharp::Parser::AST::Function::IsDefaulted::get()
{
return ((::CppSharp::CppParser::AST::Function*)NativePtr)->isDefaulted;
}
void CppSharp::Parser::AST::Function::IsDefaulted::set(bool value)
{
((::CppSharp::CppParser::AST::Function*)NativePtr)->isDefaulted = value;
}
CppSharp::Parser::AST::FriendKind CppSharp::Parser::AST::Function::FriendKind::get()
{
return (CppSharp::Parser::AST::FriendKind)((::CppSharp::CppParser::AST::Function*)NativePtr)->friendKind;

6
src/CppParser/Bindings/CLI/AST.h

@ -2072,6 +2072,12 @@ namespace CppSharp @@ -2072,6 +2072,12 @@ namespace CppSharp
void set(bool);
}
property bool IsDefaulted
{
bool get();
void set(bool);
}
property CppSharp::Parser::AST::FriendKind FriendKind
{
CppSharp::Parser::AST::FriendKind get();

19
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -7168,6 +7168,9 @@ namespace CppSharp @@ -7168,6 +7168,9 @@ namespace CppSharp
[FieldOffset(246)]
internal byte isDeleted;
[FieldOffset(247)]
internal byte isDefaulted;
[FieldOffset(248)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@ -7429,6 +7432,19 @@ namespace CppSharp @@ -7429,6 +7432,19 @@ namespace CppSharp
}
}
public bool IsDefaulted
{
get
{
return ((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted != 0;
}
set
{
((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted = (byte) (value ? 1 : 0);
}
}
public global::CppSharp.Parser.AST.FriendKind FriendKind
{
get
@ -7700,6 +7716,9 @@ namespace CppSharp @@ -7700,6 +7716,9 @@ namespace CppSharp
[FieldOffset(246)]
internal byte isDeleted;
[FieldOffset(247)]
internal byte isDefaulted;
[FieldOffset(248)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;

15
src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/Std.cs

@ -122,6 +122,21 @@ namespace Std @@ -122,6 +122,21 @@ namespace Std
{
namespace __1
{
namespace Vector
{
[StructLayout(LayoutKind.Explicit, Size = 12)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::System.IntPtr __begin_;
[FieldOffset(4)]
internal global::System.IntPtr __end_;
[FieldOffset(8)]
internal global::Std.__1.CompressedPair.__Internal __end_cap_;
}
}
}
}

19
src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs

@ -7168,6 +7168,9 @@ namespace CppSharp @@ -7168,6 +7168,9 @@ namespace CppSharp
[FieldOffset(278)]
internal byte isDeleted;
[FieldOffset(279)]
internal byte isDefaulted;
[FieldOffset(280)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@ -7429,6 +7432,19 @@ namespace CppSharp @@ -7429,6 +7432,19 @@ namespace CppSharp
}
}
public bool IsDefaulted
{
get
{
return ((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted != 0;
}
set
{
((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted = (byte) (value ? 1 : 0);
}
}
public global::CppSharp.Parser.AST.FriendKind FriendKind
{
get
@ -7700,6 +7716,9 @@ namespace CppSharp @@ -7700,6 +7716,9 @@ namespace CppSharp
[FieldOffset(278)]
internal byte isDeleted;
[FieldOffset(279)]
internal byte isDefaulted;
[FieldOffset(280)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;

19
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs

@ -7167,6 +7167,9 @@ namespace CppSharp @@ -7167,6 +7167,9 @@ namespace CppSharp
[FieldOffset(470)]
internal byte isDeleted;
[FieldOffset(471)]
internal byte isDefaulted;
[FieldOffset(472)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@ -7428,6 +7431,19 @@ namespace CppSharp @@ -7428,6 +7431,19 @@ namespace CppSharp
}
}
public bool IsDefaulted
{
get
{
return ((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted != 0;
}
set
{
((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted = (byte) (value ? 1 : 0);
}
}
public global::CppSharp.Parser.AST.FriendKind FriendKind
{
get
@ -7699,6 +7715,9 @@ namespace CppSharp @@ -7699,6 +7715,9 @@ namespace CppSharp
[FieldOffset(470)]
internal byte isDeleted;
[FieldOffset(471)]
internal byte isDefaulted;
[FieldOffset(472)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;

15
src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/Std.cs

@ -122,6 +122,21 @@ namespace Std @@ -122,6 +122,21 @@ namespace Std
{
namespace __1
{
namespace Vector
{
[StructLayout(LayoutKind.Explicit, Size = 24)]
public unsafe partial struct __Internal
{
[FieldOffset(0)]
internal global::System.IntPtr __begin_;
[FieldOffset(8)]
internal global::System.IntPtr __end_;
[FieldOffset(16)]
internal global::Std.__1.CompressedPair.__Internal __end_cap_;
}
}
}
}

19
src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs

@ -7167,6 +7167,9 @@ namespace CppSharp @@ -7167,6 +7167,9 @@ namespace CppSharp
[FieldOffset(518)]
internal byte isDeleted;
[FieldOffset(519)]
internal byte isDefaulted;
[FieldOffset(520)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@ -7428,6 +7431,19 @@ namespace CppSharp @@ -7428,6 +7431,19 @@ namespace CppSharp
}
}
public bool IsDefaulted
{
get
{
return ((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted != 0;
}
set
{
((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted = (byte) (value ? 1 : 0);
}
}
public global::CppSharp.Parser.AST.FriendKind FriendKind
{
get
@ -7699,6 +7715,9 @@ namespace CppSharp @@ -7699,6 +7715,9 @@ namespace CppSharp
[FieldOffset(518)]
internal byte isDeleted;
[FieldOffset(519)]
internal byte isDefaulted;
[FieldOffset(520)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;

19
src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs

@ -7167,6 +7167,9 @@ namespace CppSharp @@ -7167,6 +7167,9 @@ namespace CppSharp
[FieldOffset(446)]
internal byte isDeleted;
[FieldOffset(447)]
internal byte isDefaulted;
[FieldOffset(448)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@ -7428,6 +7431,19 @@ namespace CppSharp @@ -7428,6 +7431,19 @@ namespace CppSharp
}
}
public bool IsDefaulted
{
get
{
return ((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted != 0;
}
set
{
((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted = (byte) (value ? 1 : 0);
}
}
public global::CppSharp.Parser.AST.FriendKind FriendKind
{
get
@ -7699,6 +7715,9 @@ namespace CppSharp @@ -7699,6 +7715,9 @@ namespace CppSharp
[FieldOffset(446)]
internal byte isDeleted;
[FieldOffset(447)]
internal byte isDefaulted;
[FieldOffset(448)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;

19
src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs

@ -7168,6 +7168,9 @@ namespace CppSharp @@ -7168,6 +7168,9 @@ namespace CppSharp
[FieldOffset(486)]
internal byte isDeleted;
[FieldOffset(487)]
internal byte isDefaulted;
[FieldOffset(488)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@ -7429,6 +7432,19 @@ namespace CppSharp @@ -7429,6 +7432,19 @@ namespace CppSharp
}
}
public bool IsDefaulted
{
get
{
return ((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted != 0;
}
set
{
((global::CppSharp.Parser.AST.Function.__Internal*) __Instance)->isDefaulted = (byte) (value ? 1 : 0);
}
}
public global::CppSharp.Parser.AST.FriendKind FriendKind
{
get
@ -7700,6 +7716,9 @@ namespace CppSharp @@ -7700,6 +7716,9 @@ namespace CppSharp
[FieldOffset(486)]
internal byte isDeleted;
[FieldOffset(487)]
internal byte isDefaulted;
[FieldOffset(488)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;

1
src/CppParser/Parser.cpp

@ -2859,6 +2859,7 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F, @@ -2859,6 +2859,7 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F,
F->isDependent = FD->isDependentContext();
F->isPure = FD->isPure();
F->isDeleted = FD->isDeleted();
F->isDefaulted = FD->isDefaulted();
SetBody(FD, F);
if (auto InstantiatedFrom = FD->getTemplateInstantiationPattern())
F->instantiatedFrom = static_cast<Function*>(WalkDeclaration(InstantiatedFrom));

10
src/Generator/Passes/GenerateSymbolsPass.cs

@ -31,7 +31,8 @@ namespace CppSharp.Passes @@ -31,7 +31,8 @@ namespace CppSharp.Passes
{
var result = base.VisitASTContext(context);
var findSymbolsPass = Context.TranslationUnitPasses.FindPass<FindSymbolsPass>();
findSymbolsPass.Wait = true;
if (remainingCompilationTasks > 0)
findSymbolsPass.Wait = true;
GenerateSymbols();
return result;
}
@ -50,7 +51,8 @@ namespace CppSharp.Passes @@ -50,7 +51,8 @@ namespace CppSharp.Passes
symbolsCodeGenerator.NewLine();
foreach (var specialization in specializations[module])
foreach (var method in specialization.Methods.Where(
m => m.IsGenerated && !m.IsDependent && !m.IsImplicit && !m.IsDeleted))
m => m.IsGenerated && !m.IsDependent && !m.IsImplicit &&
!m.IsDeleted && !m.IsDefaulted))
symbolsCodeGenerator.VisitMethodDecl(method);
}
@ -124,8 +126,8 @@ namespace CppSharp.Passes @@ -124,8 +126,8 @@ namespace CppSharp.Passes
{
var mangled = function.Mangled;
var method = function as Method;
return function.IsGenerated && !function.IsDeleted && !function.IsDependent &&
!function.IsPure &&
return function.IsGenerated && !function.IsDeleted && !function.IsDefaulted &&
!function.IsDependent && !function.IsPure &&
(!string.IsNullOrEmpty(function.Body) || function.IsImplicit) &&
!(function.Namespace is ClassTemplateSpecialization) &&
// we don't need symbols for virtual functions anyway

1
src/Parser/ASTConverter.cs

@ -1170,6 +1170,7 @@ namespace CppSharp @@ -1170,6 +1170,7 @@ namespace CppSharp
_function.IsInline = function.IsInline;
_function.IsPure = function.IsPure;
_function.IsDeleted = function.IsDeleted;
_function.IsDefaulted = function.IsDefaulted;
_function.FriendKind = VisitFriendKind(function.FriendKind);
_function.OperatorKind = VisitCXXOperatorKind(function.OperatorKind);
_function.Mangled = function.Mangled;

Loading…
Cancel
Save