Permalink
Browse files

Ignored defaulted functions when generating C++ for symbols.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Aug 9, 2017
1 parent 27acdd2 commit 9294ea09783f5c4f448b42925be24468b55084d6
@@ -158,6 +158,10 @@ public Function(Function function)
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 @@ public Function(Function function)
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; }
@@ -633,6 +633,7 @@ Function::Function()
, isInline(false)
, isPure(false)
, isDeleted(false)
, isDefaulted(false)
, friendKind(FriendKind::None)
, operatorKind(CXXOperatorKind::None)
, callingConvention(CallingConvention::Default)
@@ -731,6 +731,7 @@ class CS_API Function : public DeclarationContext
bool isInline;
bool isPure;
bool isDeleted;
bool isDefaulted;
FriendKind friendKind;
CXXOperatorKind operatorKind;
std::string mangled;
@@ -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;
@@ -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();
@@ -7168,6 +7168,9 @@ public new partial struct __Internal
[FieldOffset(246)]
internal byte isDeleted;
[FieldOffset(247)]
internal byte isDefaulted;
[FieldOffset(248)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7429,6 +7432,19 @@ public bool IsDeleted
}
}
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 @@ public new partial struct __Internal
[FieldOffset(246)]
internal byte isDeleted;
[FieldOffset(247)]
internal byte isDefaulted;
[FieldOffset(248)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -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_;
}
}
}
}
@@ -7168,6 +7168,9 @@ public new partial struct __Internal
[FieldOffset(278)]
internal byte isDeleted;
[FieldOffset(279)]
internal byte isDefaulted;
[FieldOffset(280)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7429,6 +7432,19 @@ public bool IsDeleted
}
}
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 @@ public new partial struct __Internal
[FieldOffset(278)]
internal byte isDeleted;
[FieldOffset(279)]
internal byte isDefaulted;
[FieldOffset(280)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7167,6 +7167,9 @@ public new partial struct __Internal
[FieldOffset(470)]
internal byte isDeleted;
[FieldOffset(471)]
internal byte isDefaulted;
[FieldOffset(472)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7428,6 +7431,19 @@ public bool IsDeleted
}
}
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 @@ public new partial struct __Internal
[FieldOffset(470)]
internal byte isDeleted;
[FieldOffset(471)]
internal byte isDefaulted;
[FieldOffset(472)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -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_;
}
}
}
}
@@ -7167,6 +7167,9 @@ public new partial struct __Internal
[FieldOffset(518)]
internal byte isDeleted;
[FieldOffset(519)]
internal byte isDefaulted;
[FieldOffset(520)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7428,6 +7431,19 @@ public bool IsDeleted
}
}
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 @@ public new partial struct __Internal
[FieldOffset(518)]
internal byte isDeleted;
[FieldOffset(519)]
internal byte isDefaulted;
[FieldOffset(520)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7167,6 +7167,9 @@ public new partial struct __Internal
[FieldOffset(446)]
internal byte isDeleted;
[FieldOffset(447)]
internal byte isDefaulted;
[FieldOffset(448)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7428,6 +7431,19 @@ public bool IsDeleted
}
}
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 @@ public new partial struct __Internal
[FieldOffset(446)]
internal byte isDeleted;
[FieldOffset(447)]
internal byte isDefaulted;
[FieldOffset(448)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7168,6 +7168,9 @@ public new partial struct __Internal
[FieldOffset(486)]
internal byte isDeleted;
[FieldOffset(487)]
internal byte isDefaulted;
[FieldOffset(488)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -7429,6 +7432,19 @@ public bool IsDeleted
}
}
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 @@ public new partial struct __Internal
[FieldOffset(486)]
internal byte isDeleted;
[FieldOffset(487)]
internal byte isDefaulted;
[FieldOffset(488)]
internal global::CppSharp.Parser.AST.FriendKind friendKind;
@@ -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));
@@ -31,7 +31,8 @@ public override bool VisitASTContext(ASTContext context)
{
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 @@ private void GenerateSymbols()
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 @@ private bool NeedsSymbol(Function function)
{
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
@@ -1170,6 +1170,7 @@ public void VisitFunction(Function function, AST.Function _function)
_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;

0 comments on commit 9294ea0

Please sign in to comment.