Skip to content

Commit

Permalink
fixup! Always pass a valid begin iterator to parse methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Jan 16, 2024
1 parent f756af0 commit 1c98d02
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion spicy/toolchain/src/compiler/codegen/parser-builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ struct ProductionVisitor
builder()->addLocal("filtered_data", type::ValueReference(type::Stream()),
builder::id("filtered"));
args2[0] = builder::id("filtered_data");
args2[1] = builder::default_(type::stream::Iterator()); // FIXME(bbannier): sensible data.
args2[1] = builder::begin(builder::deref(args[0]));
args2[2] = builder::deref(args2[0]);
builder()->addExpression(builder::memberCall(state().self, id_stage2, args2));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_P0_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_P0_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -379,7 +379,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_P1_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_P1_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -614,7 +614,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_P2_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_P2_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down
14 changes: 7 additions & 7 deletions tests/Baseline/spicy.optimization.feature_requirements/noopt.hlt
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X0_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X0_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -514,7 +514,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X1_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X1_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -747,7 +747,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X2_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X2_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -980,7 +980,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X3_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X3_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1221,7 +1221,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X4_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X4_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1466,7 +1466,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X5_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X5_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1699,7 +1699,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X6_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X6_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_X5_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_X5_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down
10 changes: 5 additions & 5 deletions tests/Baseline/spicy.optimization.unused-functions/noopt.hlt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_A_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_A_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -447,7 +447,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_B_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_B_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -676,7 +676,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_C_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_C_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -909,7 +909,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_D_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_D_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1153,7 +1153,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_F_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_F_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down
18 changes: 9 additions & 9 deletions tests/Baseline/spicy.optimization.unused-types/noopt.hlt
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Priv1_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Priv1_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -584,7 +584,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Pub2_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Pub2_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -813,7 +813,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Priv2_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Priv2_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1046,7 +1046,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Priv3_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Priv3_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1279,7 +1279,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Priv4_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Priv4_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1558,7 +1558,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Priv5_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Priv5_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -1791,7 +1791,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Priv6_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Priv6_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -2024,7 +2024,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Pub3_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Pub3_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down Expand Up @@ -2299,7 +2299,7 @@ method method tuple<view<stream>, int<64>, iterator<stream>, optional<hilti::Rec

if ( filtered = spicy_rt::filter_init(self, __data, __cur) ) {
local value_ref<stream> filtered_data = filtered;
(*self).__parse_foo_Priv10_stage2(filtered_data, default<iterator<stream>>(), (*filtered_data), __trim, __lah, __lahe, __error);
(*self).__parse_foo_Priv10_stage2(filtered_data, begin((*__data)), (*filtered_data), __trim, __lah, __lahe, __error);
__cur = __cur.advance(|__cur|);

if ( __trim )
Expand Down

0 comments on commit 1c98d02

Please sign in to comment.