]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Convert structs to classes
authorOwen Avery <powerboat9.gamer@gmail.com>
Tue, 14 Mar 2023 22:52:50 +0000 (18:52 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:21:10 +0000 (18:21 +0100)
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 <powerboat9.gamer@gmail.com>
gcc/rust/ast/rust-ast-full-decls.h
gcc/rust/ast/rust-item.h
gcc/rust/hir/tree/rust-hir-full-decls.h
gcc/rust/hir/tree/rust-hir-path.h

index 2275b490f1d683239f05e7bc4944a082de12829c..b3f71c0addb73208de7699d4120c504bcf26adee 100644 (file)
@@ -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;
 
index a094cc4913d1ae338accfd2603621538b632dc88..883b010ccb65e357a0dd323c523e2c873ad68278 100644 (file)
@@ -315,9 +315,8 @@ protected:
 };
 
 // A where clause
-struct WhereClause
+class WhereClause
 {
-private:
   std::vector<std::unique_ptr<WhereClauseItem>> 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<Attribute> outer_attrs;
   Location locus;
   std::unique_ptr<Pattern> param_name;
@@ -1904,9 +1900,8 @@ protected:
 };
 
 // A single field in a struct
-struct StructField
+class StructField
 {
-private:
   // bool has_outer_attributes;
   std::vector<Attribute> outer_attrs;
 
@@ -2058,9 +2053,8 @@ protected:
 };
 
 // A single field in a tuple
-struct TupleField
+class TupleField
 {
-private:
   // bool has_outer_attributes;
   std::vector<Attribute> 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;
 
index a410103fdd468da02895555696b3f879c0ef8d2d..32c5c430ea021ade7c220b753c7e14f0ac5de3f7 100644 (file)
@@ -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;
 
index f17b8a35ddacaf46091a63c8d977a7199c7d9c8c..b615fbfbb337ffc45e1979ffa033d26732904de4 100644 (file)
@@ -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> type;
 
@@ -547,9 +546,8 @@ public:
 };
 
 // A function as represented in a type path
-struct TypePathFunction
+class TypePathFunction
 {
-private:
   std::vector<std::unique_ptr<Type> > inputs;
   std::unique_ptr<Type> return_type;
 
@@ -761,9 +759,8 @@ public:
   }
 };
 
-struct QualifiedPathType
+class QualifiedPathType
 {
-private:
   std::unique_ptr<Type> type;
   std::unique_ptr<TypePath> trait;
   Location locus;