Skip to content

Commit

Permalink
Fix/bootstrap update (mono#1904)
Browse files Browse the repository at this point in the history
* Fix warning

* Code cleanup

* Add missing native project launch settings

* Fix bootstrap generator

Update bootstrap / parser gen lang version

* Fix bug in `std::optional` mapping

* Fix crash with null template

* Use arm64 headers if available

* Support some `std::optional/vector` methods

* Add optional for csharp

* Template type alias cast fix

* Update generated bootstrap/parser  bindings

* Temp fix for build errors in bindings

* Fix `IgnoreSystemDeclsPass` not visiting all declared overrides

* Drop optional support for now

I'm struck on `std::optional:<>:operator=(Ty&&)`, would need to add some code that handles by creating a function for default template arguments but this PR has already become way too large

* Add formatting settings

* Format all files
  • Loading branch information
duckdoom5 authored Feb 24, 2025
1 parent 9d1c484 commit b871486
Show file tree
Hide file tree
Showing 58 changed files with 64,828 additions and 40,971 deletions.
781 changes: 519 additions & 262 deletions src/AST/Expr.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/AST/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public enum FunctionSynthKind
DefaultValueOverload,
InterfaceInstance,
InterfaceDispose,
FieldAcessor
FieldAccessor
}

public enum FriendKind
Expand Down Expand Up @@ -260,7 +260,7 @@ public QualifiedType OriginalReturnType
}

public FunctionSynthKind SynthKind { get; set; }
public bool IsSynthetized => SynthKind != FunctionSynthKind.None;
public bool IsSynthesized => SynthKind != FunctionSynthKind.None;
public bool IsNonMemberOperator { get; set; }

public Function OriginalFunction { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/AST/FunctionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static bool NeedsSymbol(this Method method)
Class @class = (Class)(method.OriginalFunction ?? method).Namespace;
// virtual functions cannot really be inlined and
// we don't need their symbols anyway as we call them through the v-table
return (!method.IsVirtual && !method.IsSynthetized &&
return (!method.IsVirtual && !method.IsSynthesized &&
!method.IsDefaultConstructor && !method.IsCopyConstructor && !method.IsDestructor) ||
(method.IsDefaultConstructor && @class.HasNonTrivialDefaultConstructor) ||
(method.IsCopyConstructor && @class.HasNonTrivialCopyConstructor) ||
Expand Down
25 changes: 9 additions & 16 deletions src/AST/Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,11 @@ public Method(Function function)
public bool IsExplicit { get; set; }
public bool IsVolatile { get; set; }

private bool? isOverride;
public bool IsOverride
{
get { return isOverride ?? OverriddenMethods.Any(); }
set { isOverride = value; }
get => isOverride ?? OverriddenMethods.Any();
set => isOverride = value;
}

public Method BaseMethod => OverriddenMethods.FirstOrDefault();
Expand All @@ -141,7 +142,7 @@ public bool IsOverride
private CXXMethodKind kind;
public CXXMethodKind Kind
{
get { return kind; }
get => kind;
set
{
if (kind != value)
Expand All @@ -153,15 +154,9 @@ public CXXMethodKind Kind
}
}

public bool IsConstructor
{
get { return Kind == CXXMethodKind.Constructor; }
}
public bool IsConstructor => Kind == CXXMethodKind.Constructor;

public bool IsDestructor
{
get { return Kind == CXXMethodKind.Destructor; }
}
public bool IsDestructor => Kind == CXXMethodKind.Destructor;

public bool IsDefaultConstructor;
public bool IsCopyConstructor;
Expand All @@ -175,23 +170,21 @@ public bool IsDestructor

public int AdjustedOffset { get; set; }

public List<Method> OverriddenMethods { get; } = new List<Method>();
public List<Method> OverriddenMethods { get; } = new();

public bool ConvertToProperty { get; set; }

public Method GetRootBaseMethod()
{
return BaseMethod == null || BaseMethod.BaseMethod == null ?
return BaseMethod?.BaseMethod == null ?
BaseMethod : BaseMethod.GetRootBaseMethod();
}

public override T Visit<T>(IDeclVisitor<T> visitor)
{
return visitor.VisitMethodDecl(this);
}

private bool? isOverride;


public bool HasSameSignature(Method other)
{
return Parameters.SequenceEqual(other.Parameters, ParameterTypeComparer.Instance);
Expand Down
4 changes: 2 additions & 2 deletions src/AST/Property.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public Property(Property property)
GetMethod is {OperatorKind: CXXOperatorKind.Subscript};

public bool IsSynthetized =>
(GetMethod != null && GetMethod.IsSynthetized) ||
(SetMethod != null && SetMethod.IsSynthetized);
(GetMethod != null && GetMethod.IsSynthesized) ||
(SetMethod != null && SetMethod.IsSynthesized);

public override T Visit<T>(IDeclVisitor<T> visitor)
{
Expand Down
Loading

0 comments on commit b871486

Please sign in to comment.