@@ -1134,7 +1134,7 @@ recording::context::new_global_init_rvalue (lvalue *variable,
1134
1134
gbl->set_rvalue_init (init); /* Needed by the global for write dump. */
1135
1135
}
1136
1136
1137
- /* Create a recording::memento_of_sizeof instance and add it
1137
+ /* Create a recording::memento_of_typeinfo instance and add it
1138
1138
to this context's list of mementos.
1139
1139
1140
1140
Implements the post-error-checking part of
@@ -1144,7 +1144,22 @@ recording::rvalue *
1144
1144
recording::context::new_sizeof (recording::type *type)
1145
1145
{
1146
1146
recording::rvalue *result =
1147
- new memento_of_sizeof (this , NULL , type);
1147
+ new memento_of_typeinfo (this , NULL , type, TYPE_INFO_SIZE_OF);
1148
+ record (result);
1149
+ return result;
1150
+ }
1151
+
1152
+ /* Create a recording::memento_of_typeinfo instance and add it
1153
+ to this context's list of mementos.
1154
+
1155
+ Implements the post-error-checking part of
1156
+ gcc_jit_context_new_alignof. */
1157
+
1158
+ recording::rvalue *
1159
+ recording::context::new_alignof (recording::type *type)
1160
+ {
1161
+ recording::rvalue *result =
1162
+ new memento_of_typeinfo (this , NULL , type, TYPE_INFO_ALIGN_OF);
1148
1163
record (result);
1149
1164
return result;
1150
1165
}
@@ -5805,39 +5820,69 @@ memento_of_new_rvalue_from_const <void *>::write_reproducer (reproducer &r)
5805
5820
5806
5821
} // namespace recording
5807
5822
5808
- /* The implementation of class gcc::jit::recording::memento_of_sizeof . */
5823
+ /* The implementation of class gcc::jit::recording::memento_of_typeinfo . */
5809
5824
5810
5825
/* Implementation of pure virtual hook recording::memento::replay_into
5811
- for recording::memento_of_sizeof . */
5826
+ for recording::memento_of_typeinfo . */
5812
5827
5813
5828
void
5814
- recording::memento_of_sizeof ::replay_into (replayer *r)
5829
+ recording::memento_of_typeinfo ::replay_into (replayer *r)
5815
5830
{
5816
- set_playback_obj (r->new_sizeof (m_type->playback_type ()));
5831
+ switch (m_info_type)
5832
+ {
5833
+ case TYPE_INFO_ALIGN_OF:
5834
+ set_playback_obj (r->new_alignof (m_type->playback_type ()));
5835
+ break ;
5836
+ case TYPE_INFO_SIZE_OF:
5837
+ set_playback_obj (r->new_sizeof (m_type->playback_type ()));
5838
+ break ;
5839
+ }
5817
5840
}
5818
5841
5819
5842
/* Implementation of recording::memento::make_debug_string for
5820
5843
sizeof expressions. */
5821
5844
5822
5845
recording::string *
5823
- recording::memento_of_sizeof ::make_debug_string ()
5846
+ recording::memento_of_typeinfo ::make_debug_string ()
5824
5847
{
5848
+ const char * ident;
5849
+ switch (m_info_type)
5850
+ {
5851
+ case TYPE_INFO_ALIGN_OF:
5852
+ ident = " _Alignof" ;
5853
+ break ;
5854
+ case TYPE_INFO_SIZE_OF:
5855
+ ident = " sizeof" ;
5856
+ break ;
5857
+ }
5825
5858
return string::from_printf (m_ctxt,
5826
- " sizeof (%s)" ,
5859
+ " %s (%s)" ,
5860
+ ident,
5827
5861
m_type->get_debug_string ());
5828
5862
}
5829
5863
5830
5864
/* Implementation of recording::memento::write_reproducer for sizeof
5831
5865
expressions. */
5832
5866
5833
5867
void
5834
- recording::memento_of_sizeof ::write_reproducer (reproducer &r)
5868
+ recording::memento_of_typeinfo ::write_reproducer (reproducer &r)
5835
5869
{
5870
+ const char * type;
5871
+ switch (m_info_type)
5872
+ {
5873
+ case TYPE_INFO_ALIGN_OF:
5874
+ type = " align" ;
5875
+ break ;
5876
+ case TYPE_INFO_SIZE_OF:
5877
+ type = " size" ;
5878
+ break ;
5879
+ }
5836
5880
const char *id = r.make_identifier (this , " rvalue" );
5837
5881
r.write (" gcc_jit_rvalue *%s =\n "
5838
- " gcc_jit_context_new_sizeof (%s, /* gcc_jit_context *ctxt */\n "
5839
- " %s); /* gcc_jit_type *type */\n " ,
5882
+ " gcc_jit_context_new_%sof (%s, /* gcc_jit_context *ctxt */\n "
5883
+ " (gcc_jit_type *) %s); /* gcc_jit_type *type */\n " ,
5840
5884
id,
5885
+ type,
5841
5886
r.get_identifier (get_context ()),
5842
5887
r.get_identifier (m_type));
5843
5888
}
0 commit comments