public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Convert structs to classes
@ 2023-03-20 7:22 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-03-20 7:22 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7ef3277cb26efeeafe51d140aef5558ec9bcaca0
commit 7ef3277cb26efeeafe51d140aef5558ec9bcaca0
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date: Tue Mar 14 18:52:50 2023 -0400
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>
Diff:
---
gcc/rust/ast/rust-ast-full-decls.h | 18 +++++++++---------
gcc/rust/ast/rust-item.h | 27 +++++++++------------------
gcc/rust/hir/tree/rust-hir-full-decls.h | 6 +++---
gcc/rust/hir/tree/rust-hir-path.h | 9 +++------
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 fee174b5cf6..ed0d98148fb 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 2646c526503..80421c5bed8 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 e49888c67c3..5e35666250a 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 f8a7dab0001..88d0ff93ea3 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-20 7:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 7:22 [gcc/devel/rust/master] Convert structs to classes Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).