aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-03-14 18:52:50 -0400
committerPhilip Herron <philip.herron@embecosm.com>2023-03-15 10:23:29 +0000
commit7ef3277cb26efeeafe51d140aef5558ec9bcaca0 (patch)
treedb89b5cf2877ce5e0190fd11f38d6384c0ca0edc /gcc
parent26e4aa3cd57f9e36b7c6404fab6f0ace1e5e3576 (diff)
downloadgcc-7ef3277cb26efeeafe51d140aef5558ec9bcaca0.zip
gcc-7ef3277cb26efeeafe51d140aef5558ec9bcaca0.tar.gz
gcc-7ef3277cb26efeeafe51d140aef5558ec9bcaca0.tar.bz2
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 <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-ast-full-decls.h18
-rw-r--r--gcc/rust/ast/rust-item.h27
-rw-r--r--gcc/rust/hir/tree/rust-hir-full-decls.h6
-rw-r--r--gcc/rust/hir/tree/rust-hir-path.h9
4 files changed, 24 insertions, 36 deletions
diff --git a/gcc/rust/ast/rust-ast-full-decls.h b/gcc/rust/ast/rust-ast-full-decls.h
index fee174b..ed0d981 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 2646c52..80421c5 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<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;
diff --git a/gcc/rust/hir/tree/rust-hir-full-decls.h b/gcc/rust/hir/tree/rust-hir-full-decls.h
index e49888c..5e35666 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 f8a7dab..88d0ff9 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> 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;