From: Owen Avery Date: Tue, 14 Mar 2023 22:52:50 +0000 (-0400) Subject: gccrs: Convert structs to classes X-Git-Tag: basepoints/gcc-15~2784 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9708900e1d53a7569c568102d5bbf56d591ea603;p=thirdparty%2Fgcc.git gccrs: Convert structs to classes gcc/rust/ChangeLog: * hir/tree/rust-hir-full-decls.h (struct GenericArgsBinding): Convert to class. (class GenericArgsBinding): Convert from struct. (struct TypePathFunction): See above. (class TypePathFunction): See above. (struct QualifiedPathType): See above. (class QualifiedPathType): See above. * ast/rust-ast-full-decls.h (struct WhereClause): See above. (class WhereClause): See above. (struct SelfParam): See above. (class SelfParam): See above. (struct FunctionQualifiers): See above. (class FunctionQualifiers): See above. (struct FunctionParam): See above. (class FunctionParam): See above. (struct StructField): See above. (class StructField): See above. (struct TupleField): See above. (class TupleField): See above. (struct TraitFunctionDecl): See above. (class TraitFunctionDecl): See above. (struct TraitMethodDecl): See above. (class TraitMethodDecl): See above. (struct NamedFunctionParam): See above. (class NamedFunctionParam): See above. * hir/tree/rust-hir-path.h (struct GenericArgsBinding): See above. (class GenericArgsBinding): See above. (struct TypePathFunction): See above. (class TypePathFunction): See above. (struct QualifiedPathType): See above. (class QualifiedPathType): See above. * ast/rust-item.h (struct WhereClause): See above. (class WhereClause): See above. (struct SelfParam): See above. (class SelfParam): See above. (struct FunctionQualifiers): See above. (class FunctionQualifiers): See above. (struct FunctionParam): See above. (class FunctionParam): See above. (struct StructField): See above. (class StructField): See above. (struct TupleField): See above. (class TupleField): See above. (struct TraitFunctionDecl): See above. (class TraitFunctionDecl): See above. (struct TraitMethodDecl): See above. (class TraitMethodDecl): See above. (struct NamedFunctionParam): See above. (class NamedFunctionParam): See above. Signed-off-by: Owen Avery --- diff --git a/gcc/rust/ast/rust-ast-full-decls.h b/gcc/rust/ast/rust-ast-full-decls.h index 2275b490f1d6..b3f71c0addb7 100644 --- a/gcc/rust/ast/rust-ast-full-decls.h +++ b/gcc/rust/ast/rust-ast-full-decls.h @@ -163,10 +163,10 @@ class TypeParam; class WhereClauseItem; class LifetimeWhereClauseItem; class TypeBoundWhereClauseItem; -struct WhereClause; -struct SelfParam; -struct FunctionQualifiers; -struct FunctionParam; +class WhereClause; +class SelfParam; +class FunctionQualifiers; +class FunctionParam; struct Visibility; class Method; class VisItem; @@ -180,9 +180,9 @@ class UseDeclaration; class Function; class TypeAlias; class Struct; -struct StructField; +class StructField; class StructStruct; -struct TupleField; +class TupleField; class TupleStruct; class EnumItem; class EnumItemTuple; @@ -192,9 +192,9 @@ class Enum; class Union; class ConstantItem; class StaticItem; -struct TraitFunctionDecl; +class TraitFunctionDecl; class TraitItemFunc; -struct TraitMethodDecl; +class TraitMethodDecl; class TraitItemMethod; class TraitItemConst; class TraitItemType; @@ -205,7 +205,7 @@ class TraitImpl; class ExternalItem; class ExternalTypeItem; class ExternalStaticItem; -struct NamedFunctionParam; +class NamedFunctionParam; class ExternalFunctionItem; class ExternBlock; diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h index a094cc4913d1..883b010ccb65 100644 --- a/gcc/rust/ast/rust-item.h +++ b/gcc/rust/ast/rust-item.h @@ -315,9 +315,8 @@ protected: }; // A where clause -struct WhereClause +class WhereClause { -private: std::vector> where_clause_items; NodeId node_id; @@ -376,9 +375,8 @@ public: }; // A self parameter in a method -struct SelfParam +class SelfParam { -private: bool has_ref; bool is_mut; // bool has_lifetime; // only possible if also ref @@ -486,9 +484,8 @@ public: }; // Qualifiers for function, i.e. const, unsafe, extern etc. -struct FunctionQualifiers +class FunctionQualifiers { -private: AsyncConstStatus const_status; bool has_unsafe; bool has_extern; @@ -522,9 +519,8 @@ public: }; // A function parameter -struct FunctionParam +class FunctionParam { -private: std::vector outer_attrs; Location locus; std::unique_ptr param_name; @@ -1904,9 +1900,8 @@ protected: }; // A single field in a struct -struct StructField +class StructField { -private: // bool has_outer_attributes; std::vector outer_attrs; @@ -2058,9 +2053,8 @@ protected: }; // A single field in a tuple -struct TupleField +class TupleField { -private: // bool has_outer_attributes; std::vector outer_attrs; @@ -2788,9 +2782,8 @@ protected: }; // Function declaration in traits -struct TraitFunctionDecl +class TraitFunctionDecl { -private: // TODO: delete and replace with Function decl item? no as no body in this. FunctionQualifiers qualifiers; Identifier function_name; @@ -2997,9 +2990,8 @@ protected: }; // Method declaration within traits -struct TraitMethodDecl +class TraitMethodDecl { -private: // TODO: delete and replace with Function decl item? no as no body. FunctionQualifiers qualifiers; Identifier function_name; @@ -4094,9 +4086,8 @@ protected: }; // A named function parameter used in external functions -struct NamedFunctionParam +class NamedFunctionParam { -private: // bool has_name; // otherwise is _ std::string name; diff --git a/gcc/rust/hir/tree/rust-hir-full-decls.h b/gcc/rust/hir/tree/rust-hir-full-decls.h index a410103fdd46..32c5c430ea02 100644 --- a/gcc/rust/hir/tree/rust-hir-full-decls.h +++ b/gcc/rust/hir/tree/rust-hir-full-decls.h @@ -45,17 +45,17 @@ class PathExpr; // rust-path.h class PathIdentSegment; -struct GenericArgsBinding; +class GenericArgsBinding; class GenericArgs; class PathExprSegment; class PathPattern; class PathInExpression; class TypePathSegment; class TypePathSegmentGeneric; -struct TypePathFunction; +class TypePathFunction; class TypePathSegmentFunction; class TypePath; -struct QualifiedPathType; +class QualifiedPathType; class QualifiedPathInExpression; class QualifiedPathInType; diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h index f17b8a35ddac..b615fbfbb337 100644 --- a/gcc/rust/hir/tree/rust-hir-path.h +++ b/gcc/rust/hir/tree/rust-hir-path.h @@ -53,9 +53,8 @@ public: }; // A binding of an identifier to a type used in generic arguments in paths -struct GenericArgsBinding +class GenericArgsBinding { -private: Identifier identifier; std::unique_ptr type; @@ -547,9 +546,8 @@ public: }; // A function as represented in a type path -struct TypePathFunction +class TypePathFunction { -private: std::vector > inputs; std::unique_ptr return_type; @@ -761,9 +759,8 @@ public: } }; -struct QualifiedPathType +class QualifiedPathType { -private: std::unique_ptr type; std::unique_ptr trait; Location locus;