Skip to content

Commit ca4f00c

Browse files
committed
Fix "noncopyable" comment, and rebuild reflect.h after for loop fix
See #447 comment thread and 38aec57#r113218852
1 parent 028caa0 commit ca4f00c

File tree

4 files changed

+22
-31
lines changed

4 files changed

+22
-31
lines changed

regression-tests/test-results/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
cppfront compiler v0.2.1 Build 8514:1724
2+
cppfront compiler v0.2.1 Build 8515:0535
33
Copyright(c) Herb Sutter All rights reserved
44

55
SPDX-License-Identifier: CC-BY-NC-ND-4.0

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"8514:1724"
1+
"8515:0535"

source/reflect.h

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ namespace meta {
182182
//-----------------------------------------------------------------------
183183
//
184184

185-
// All declarations are noncopyable wrappers around a pointer to node
185+
// All declarations are wrappers around a pointer to node
186186
//
187187
class declaration_base
188188
: public compiler_services {
@@ -808,43 +808,39 @@ declaration::declaration(declaration const& that)
808808
std::vector<function_declaration>
809809
{
810810
std::vector<function_declaration> ret {};
811-
{ auto const& cpp2_range = CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::functions); for ( auto const& d : cpp2_range ) {
811+
for ( auto const& d : CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::functions) ) {
812812
CPP2_UFCS(emplace_back, ret, d, (*this));
813-
}}
814-
#line 332 "reflect.h2"
813+
}
815814
return ret;
816815
}
817816

818817
[[nodiscard]] auto type_declaration::get_member_objects() const ->
819818
std::vector<object_declaration>
820819
{
821820
std::vector<object_declaration> ret {};
822-
{ auto const& cpp2_range = CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::objects); for ( auto const& d : cpp2_range ) {
821+
for ( auto const& d : CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::objects) ) {
823822
CPP2_UFCS(emplace_back, ret, d, (*this));
824-
}}
825-
#line 342 "reflect.h2"
823+
}
826824
return ret;
827825
}
828826

829827
[[nodiscard]] auto type_declaration::get_member_types() const ->
830828
std::vector<type_declaration>
831829
{
832830
std::vector<type_declaration> ret {};
833-
{ auto const& cpp2_range = CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::types); for ( auto const& d : cpp2_range ) {
831+
for ( auto const& d : CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::types) ) {
834832
CPP2_UFCS(emplace_back, ret, d, (*this));
835-
}}
836-
#line 352 "reflect.h2"
833+
}
837834
return ret;
838835
}
839836

840837
[[nodiscard]] auto type_declaration::get_members() const ->
841838
std::vector<declaration>
842839
{
843840
std::vector<declaration> ret {};
844-
{ auto const& cpp2_range = CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::all); for ( auto const& d : cpp2_range ) {
841+
for ( auto const& d : CPP2_UFCS(get_type_scope_declarations, (*cpp2::assert_not_null(n)), declaration_node::all) ) {
845842
CPP2_UFCS(emplace_back, ret, d, (*this));
846-
}}
847-
#line 362 "reflect.h2"
843+
}
848844
return ret;
849845
}
850846

@@ -889,7 +885,7 @@ auto interface(meta::type_declaration& t) -> void
889885
{
890886
auto has_dtor {false};
891887

892-
{ auto&& cpp2_range = CPP2_UFCS_0(get_members, t); for ( auto& m : cpp2_range )
888+
for ( auto& m : CPP2_UFCS_0(get_members, t) )
893889
{
894890
CPP2_UFCS(require, m, !(CPP2_UFCS_0(is_object, m)),
895891
"interfaces may not contain data objects");
@@ -904,9 +900,8 @@ auto interface(meta::type_declaration& t) -> void
904900
CPP2_UFCS_0(make_virtual, mf);
905901
has_dtor |= CPP2_UFCS_0(is_destructor, mf);
906902
}
907-
}}
903+
}
908904

909-
#line 444 "reflect.h2"
910905
if (!(std::move(has_dtor))) {
911906
add_virtual_destructor(t);
912907
}
@@ -917,7 +912,7 @@ auto polymorphic_base(meta::type_declaration& t) -> void
917912
{
918913
auto has_dtor {false};
919914

920-
{ auto&& cpp2_range = CPP2_UFCS_0(get_member_functions, t); for ( auto& mf : cpp2_range )
915+
for ( auto& mf : CPP2_UFCS_0(get_member_functions, t) )
921916
{
922917
if (CPP2_UFCS_0(is_default_access, mf)) {
923918
CPP2_UFCS_0(make_public, mf);
@@ -930,9 +925,8 @@ auto polymorphic_base(meta::type_declaration& t) -> void
930925
|| (CPP2_UFCS_0(is_protected, mf) && !(CPP2_UFCS_0(is_virtual, mf))),
931926
"a polymorphic base type destructor must be public and virtual, or protected and nonvirtual");
932927
}
933-
}}
928+
}
934929

935-
#line 488 "reflect.h2"
936930
if (!(std::move(has_dtor))) {
937931
add_virtual_destructor(t);
938932
}
@@ -946,7 +940,7 @@ auto ordered_impl(
946940
{
947941
auto has_spaceship {false};
948942

949-
{ auto&& cpp2_range = CPP2_UFCS_0(get_member_functions, t); for ( auto& mf : cpp2_range )
943+
for ( auto& mf : CPP2_UFCS_0(get_member_functions, t) )
950944
{
951945
if (CPP2_UFCS(has_name, mf, "operator<=>")) {
952946
has_spaceship = true;
@@ -956,9 +950,8 @@ auto ordered_impl(
956950
CPP2_UFCS(error, mf, "operator<=> must return std::" + cpp2::as_<std::string>(ordering));
957951
}
958952
}
959-
}}
953+
}
960954

961-
#line 533 "reflect.h2"
962955
if (!(std::move(has_spaceship))) {
963956
CPP2_UFCS(require, t, CPP2_UFCS(add_member, t, "operator<=>: (this, that) -> std::" + (cpp2::as_<std::string>(ordering)) + ";"),
964957
"could not add operator<=> with std::" + (cpp2::as_<std::string>(ordering)));
@@ -1012,15 +1005,14 @@ auto basic_value(meta::type_declaration& t) -> void
10121005
copyable(t);
10131006

10141007
auto has_default_ctor {false};
1015-
{ auto&& cpp2_range = CPP2_UFCS_0(get_member_functions, t); for ( auto& mf : cpp2_range ) {
1008+
for ( auto& mf : CPP2_UFCS_0(get_member_functions, t) ) {
10161009
has_default_ctor |= CPP2_UFCS_0(is_default_constructor, mf);
10171010
CPP2_UFCS(require, mf, !(CPP2_UFCS_0(is_protected, mf)) && !(CPP2_UFCS_0(is_virtual, mf)),
10181011
"a value type may not have a protected or virtual function");
10191012
CPP2_UFCS(require, mf, !(CPP2_UFCS_0(is_destructor, mf)) || CPP2_UFCS_0(is_public, mf),
10201013
"a value type may not have a non-public destructor");
1021-
}}
1014+
}
10221015

1023-
#line 624 "reflect.h2"
10241016
if (!(std::move(has_default_ctor))) {
10251017
CPP2_UFCS(require, t, CPP2_UFCS(add_member, t, "operator=: (out this) = { }"),
10261018
"could not add default constructor");
@@ -1049,7 +1041,7 @@ auto partially_ordered_value(meta::type_declaration& t) -> void
10491041
#line 683 "reflect.h2"
10501042
auto cpp2_struct(meta::type_declaration& t) -> void
10511043
{
1052-
{ auto&& cpp2_range = CPP2_UFCS_0(get_members, t); for ( auto& m : cpp2_range )
1044+
for ( auto& m : CPP2_UFCS_0(get_members, t) )
10531045
{
10541046
CPP2_UFCS(require, m, CPP2_UFCS_0(make_public, m),
10551047
"all struct members must be public");
@@ -1060,8 +1052,7 @@ auto cpp2_struct(meta::type_declaration& t) -> void
10601052
CPP2_UFCS(require, t, !(CPP2_UFCS(has_name, mf, "operator=")),
10611053
"a struct may not have a user-defined operator=");
10621054
}
1063-
}}
1064-
#line 697 "reflect.h2"
1055+
}
10651056
basic_value(t); // a plain_struct is-a basic_value
10661057
}
10671058

source/reflect.h2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ meta: namespace = {
144144
//-----------------------------------------------------------------------
145145
//
146146

147-
// All declarations are noncopyable wrappers around a pointer to node
147+
// All declarations are wrappers around a pointer to node
148148
//
149149
declaration_base: @polymorphic_base @copyable type =
150150
{

0 commit comments

Comments
 (0)