@@ -4356,6 +4356,23 @@ recording::function::new_local (recording::location *loc,
43564356 return result;
43574357}
43584358
4359+ /* Create a recording::local instance and add it to
4360+ the functions's context's list of mementos, and to the function's
4361+ list of locals.
4362+
4363+ Implements the post-error-checking part of
4364+ gcc_jit_function_new_temp. */
4365+
4366+ recording::lvalue *
4367+ recording::function::new_temp (recording::location *loc,
4368+ type *type)
4369+ {
4370+ local *result = new local (this , loc, type, NULL );
4371+ m_ctxt->record (result);
4372+ m_locals.safe_push (result);
4373+ return result;
4374+ }
4375+
43594376/* Create a recording::block instance and add it to
43604377 the functions's context's list of mementos, and to the function's
43614378 list of blocks.
@@ -7226,16 +7243,26 @@ void
72267243recording::local::write_reproducer (reproducer &r)
72277244{
72287245 const char *id = r.make_identifier (this , " local" );
7229- r.write (" gcc_jit_lvalue *%s =\n "
7230- " gcc_jit_function_new_local (%s, /* gcc_jit_function *func */\n "
7231- " %s, /* gcc_jit_location *loc */\n "
7232- " %s, /* gcc_jit_type *type */\n "
7233- " %s); /* const char *name */\n " ,
7234- id,
7235- r.get_identifier (m_func),
7236- r.get_identifier (m_loc),
7237- r.get_identifier_as_type (m_type),
7238- m_name->get_debug_string ());
7246+ if (m_name)
7247+ r.write (" gcc_jit_lvalue *%s =\n "
7248+ " gcc_jit_function_new_local (%s, /* gcc_jit_function *func */\n "
7249+ " %s, /* gcc_jit_location *loc */\n "
7250+ " %s, /* gcc_jit_type *type */\n "
7251+ " %s); /* const char *name */\n " ,
7252+ id,
7253+ r.get_identifier (m_func),
7254+ r.get_identifier (m_loc),
7255+ r.get_identifier_as_type (m_type),
7256+ m_name->get_debug_string ());
7257+ else
7258+ r.write (" gcc_jit_lvalue *%s =\n "
7259+ " gcc_jit_function_new_temp (%s, /* gcc_jit_function *func */\n "
7260+ " %s, /* gcc_jit_location *loc */\n "
7261+ " %s); /* gcc_jit_type *type */\n " ,
7262+ id,
7263+ r.get_identifier (m_func),
7264+ r.get_identifier (m_loc),
7265+ r.get_identifier_as_type (m_type));
72397266}
72407267
72417268/* The implementation of class gcc::jit::recording::statement. */
0 commit comments