@@ -1134,7 +1134,7 @@ recording::context::new_global_init_rvalue (lvalue *variable,
11341134 gbl->set_rvalue_init (init); /* Needed by the global for write dump. */
11351135}
11361136
1137- /* Create a recording::memento_of_sizeof instance and add it
1137+ /* Create a recording::memento_of_typeinfo instance and add it
11381138 to this context's list of mementos.
11391139
11401140 Implements the post-error-checking part of
@@ -1144,7 +1144,22 @@ recording::rvalue *
11441144recording::context::new_sizeof (recording::type *type)
11451145{
11461146 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);
11481163 record (result);
11491164 return result;
11501165}
@@ -5805,39 +5820,69 @@ memento_of_new_rvalue_from_const <void *>::write_reproducer (reproducer &r)
58055820
58065821} // namespace recording
58075822
5808- /* The implementation of class gcc::jit::recording::memento_of_sizeof . */
5823+ /* The implementation of class gcc::jit::recording::memento_of_typeinfo . */
58095824
58105825/* Implementation of pure virtual hook recording::memento::replay_into
5811- for recording::memento_of_sizeof . */
5826+ for recording::memento_of_typeinfo . */
58125827
58135828void
5814- recording::memento_of_sizeof ::replay_into (replayer *r)
5829+ recording::memento_of_typeinfo ::replay_into (replayer *r)
58155830{
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+ }
58175840}
58185841
58195842/* Implementation of recording::memento::make_debug_string for
58205843 sizeof expressions. */
58215844
58225845recording::string *
5823- recording::memento_of_sizeof ::make_debug_string ()
5846+ recording::memento_of_typeinfo ::make_debug_string ()
58245847{
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+ }
58255858 return string::from_printf (m_ctxt,
5826- " sizeof (%s)" ,
5859+ " %s (%s)" ,
5860+ ident,
58275861 m_type->get_debug_string ());
58285862}
58295863
58305864/* Implementation of recording::memento::write_reproducer for sizeof
58315865 expressions. */
58325866
58335867void
5834- recording::memento_of_sizeof ::write_reproducer (reproducer &r)
5868+ recording::memento_of_typeinfo ::write_reproducer (reproducer &r)
58355869{
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+ }
58365880 const char *id = r.make_identifier (this , " rvalue" );
58375881 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 " ,
58405884 id,
5885+ type,
58415886 r.get_identifier (get_context ()),
58425887 r.get_identifier (m_type));
58435888}
0 commit comments