Skip to content

Commit

Permalink
Prevented C++ generation for invalid specialised functions.
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitar Dobrev <[email protected]>
  • Loading branch information
ddobrev committed Nov 21, 2017
1 parent 04a1591 commit 4dfd9cc
Show file tree
Hide file tree
Showing 15 changed files with 697 additions and 16 deletions.
2 changes: 2 additions & 0 deletions src/CppParser/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ Declaration::Declaration(DeclarationKind kind)
, isIncomplete(false)
, isDependent(false)
, isImplicit(false)
, isInvalid(false)
, completeDeclaration(0)
, definitionOrder(0)
, originalPtr(0)
Expand All @@ -268,6 +269,7 @@ Declaration::Declaration(const Declaration& rhs)
, isIncomplete(rhs.isIncomplete)
, isDependent(rhs.isDependent)
, isImplicit(rhs.isImplicit)
, isInvalid(rhs.isInvalid)
, completeDeclaration(rhs.completeDeclaration)
, definitionOrder(rhs.definitionOrder)
, PreprocessedEntities(rhs.PreprocessedEntities)
Expand Down
1 change: 1 addition & 0 deletions src/CppParser/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ class CS_API Declaration
bool isIncomplete;
bool isDependent;
bool isImplicit;
bool isInvalid;
Declaration* completeDeclaration;
unsigned definitionOrder;
VECTOR(PreprocessedEntity*, PreprocessedEntities)
Expand Down
10 changes: 10 additions & 0 deletions src/CppParser/Bindings/CLI/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,16 @@ void CppSharp::Parser::AST::Declaration::IsImplicit::set(bool value)
((::CppSharp::CppParser::AST::Declaration*)NativePtr)->isImplicit = value;
}

bool CppSharp::Parser::AST::Declaration::IsInvalid::get()
{
return ((::CppSharp::CppParser::AST::Declaration*)NativePtr)->isInvalid;
}

void CppSharp::Parser::AST::Declaration::IsInvalid::set(bool value)
{
((::CppSharp::CppParser::AST::Declaration*)NativePtr)->isInvalid = value;
}

CppSharp::Parser::AST::Declaration^ CppSharp::Parser::AST::Declaration::CompleteDeclaration::get()
{
return (((::CppSharp::CppParser::AST::Declaration*)NativePtr)->completeDeclaration == nullptr) ? nullptr : gcnew CppSharp::Parser::AST::Declaration((::CppSharp::CppParser::AST::Declaration*)((::CppSharp::CppParser::AST::Declaration*)NativePtr)->completeDeclaration);
Expand Down
6 changes: 6 additions & 0 deletions src/CppParser/Bindings/CLI/AST.h
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,12 @@ namespace CppSharp
void set(bool);
}

property bool IsInvalid
{
bool get();
void set(bool);
}

property CppSharp::Parser::AST::Declaration^ CompleteDeclaration
{
CppSharp::Parser::AST::Declaration^ get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4259,6 +4259,9 @@ public partial struct __Internal
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -4651,6 +4654,19 @@ public bool IsImplicit
}
}

public bool IsInvalid
{
get
{
return ((global::CppSharp.Parser.AST.Declaration.__Internal*) __Instance)->isInvalid != 0;
}

set
{
((global::CppSharp.Parser.AST.Declaration.__Internal*) __Instance)->isInvalid = (byte) (value ? 1 : 0);
}
}

public global::CppSharp.Parser.AST.Declaration CompleteDeclaration
{
get
Expand Down Expand Up @@ -4776,6 +4792,9 @@ public unsafe partial class DeclarationContext : global::CppSharp.Parser.AST.Dec
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -5450,6 +5469,9 @@ public unsafe partial class TypedefNameDecl : global::CppSharp.Parser.AST.Declar
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -5617,6 +5639,9 @@ public unsafe partial class TypedefDecl : global::CppSharp.Parser.AST.TypedefNam
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -5766,6 +5791,9 @@ public unsafe partial class TypeAlias : global::CppSharp.Parser.AST.TypedefNameD
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -5936,6 +5964,9 @@ public unsafe partial class Friend : global::CppSharp.Parser.AST.Declaration, ID
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -6862,6 +6893,9 @@ public unsafe partial class Parameter : global::CppSharp.Parser.AST.Declaration,
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -7093,6 +7127,9 @@ public unsafe partial class Function : global::CppSharp.Parser.AST.DeclarationCo
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -7641,6 +7678,9 @@ public unsafe partial class Method : global::CppSharp.Parser.AST.Function, IDisp
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -8093,6 +8133,9 @@ public unsafe partial class Enumeration : global::CppSharp.Parser.AST.Declaratio
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -8249,6 +8292,9 @@ public unsafe partial class Item : global::CppSharp.Parser.AST.Declaration, IDis
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -8598,6 +8644,9 @@ public unsafe partial class Variable : global::CppSharp.Parser.AST.Declaration,
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -8938,6 +8987,9 @@ public unsafe partial class Field : global::CppSharp.Parser.AST.Declaration, IDi
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -9153,6 +9205,9 @@ public unsafe partial class AccessSpecifierDecl : global::CppSharp.Parser.AST.De
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -9299,6 +9354,9 @@ public unsafe partial class Class : global::CppSharp.Parser.AST.DeclarationConte
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -9883,6 +9941,9 @@ public unsafe partial class Template : global::CppSharp.Parser.AST.Declaration,
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -10125,6 +10186,9 @@ public unsafe partial class TypeAliasTemplate : global::CppSharp.Parser.AST.Temp
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -10277,6 +10341,9 @@ public unsafe partial class TemplateParameter : global::CppSharp.Parser.AST.Decl
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -10476,6 +10543,9 @@ public unsafe partial class TemplateTemplateParameter : global::CppSharp.Parser.
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -10676,6 +10746,9 @@ public unsafe partial class TypeTemplateParameter : global::CppSharp.Parser.AST.
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -10847,6 +10920,9 @@ public unsafe partial class NonTypeTemplateParameter : global::CppSharp.Parser.A
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -11071,6 +11147,9 @@ public unsafe partial class ClassTemplate : global::CppSharp.Parser.AST.Template
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -11321,6 +11400,9 @@ public unsafe partial class ClassTemplateSpecialization : global::CppSharp.Parse
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -11634,6 +11716,9 @@ public unsafe partial class ClassTemplatePartialSpecialization : global::CppShar
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -11867,6 +11952,9 @@ public unsafe partial class FunctionTemplate : global::CppSharp.Parser.AST.Templ
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -12304,6 +12392,9 @@ public unsafe partial class VarTemplate : global::CppSharp.Parser.AST.Template,
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -12554,6 +12645,9 @@ public unsafe partial class VarTemplateSpecialization : global::CppSharp.Parser.
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -12795,6 +12889,9 @@ public unsafe partial class VarTemplatePartialSpecialization : global::CppSharp.
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -12956,6 +13053,9 @@ public unsafe partial class Namespace : global::CppSharp.Parser.AST.DeclarationC
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down Expand Up @@ -13620,6 +13720,9 @@ public unsafe partial class TranslationUnit : global::CppSharp.Parser.AST.Namesp
[FieldOffset(66)]
internal byte isImplicit;

[FieldOffset(67)]
internal byte isInvalid;

[FieldOffset(68)]
internal global::System.IntPtr completeDeclaration;

Expand Down
Loading

0 comments on commit 4dfd9cc

Please sign in to comment.