@@ -346,6 +346,60 @@ ResolveExpr::visit (AST::BlockExpr &expr)
346
346
resolver->get_label_scope ().pop ();
347
347
}
348
348
349
+ void
350
+ translate_operand (AST::InlineAsm &expr, const CanonicalPath &prefix,
351
+ const CanonicalPath &canonical_prefix)
352
+ {
353
+ const auto &operands = expr.get_operands ();
354
+ using RegisterType = AST::InlineAsmOperand::RegisterType;
355
+ for (auto &operand : operands)
356
+ {
357
+ switch (operand.get_register_type ())
358
+ {
359
+ case RegisterType::In: {
360
+ auto in = operand.get_in ();
361
+ ResolveExpr::go (*in.expr , prefix, canonical_prefix);
362
+ break ;
363
+ }
364
+ case RegisterType::Out: {
365
+ auto out = operand.get_out ();
366
+ ResolveExpr::go (*out.expr , prefix, canonical_prefix);
367
+ break ;
368
+ }
369
+ case RegisterType::InOut: {
370
+ auto in_out = operand.get_in_out ();
371
+ ResolveExpr::go (*in_out.expr , prefix, canonical_prefix);
372
+ break ;
373
+ }
374
+ case RegisterType::SplitInOut: {
375
+ auto split_in_out = operand.get_split_in_out ();
376
+ ResolveExpr::go (*split_in_out.in_expr , prefix, canonical_prefix);
377
+ ResolveExpr::go (*split_in_out.out_expr , prefix, canonical_prefix);
378
+ break ;
379
+ }
380
+ case RegisterType::Const: {
381
+ auto anon_const = operand.get_const ().anon_const ;
382
+ ResolveExpr::go (*anon_const.expr , prefix, canonical_prefix);
383
+ break ;
384
+ }
385
+ case RegisterType::Sym: {
386
+ auto sym = operand.get_sym ();
387
+ ResolveExpr::go (*sym.expr , prefix, canonical_prefix);
388
+ break ;
389
+ }
390
+ case RegisterType::Label: {
391
+ auto label = operand.get_label ();
392
+ ResolveExpr::go (*label.expr , prefix, canonical_prefix);
393
+ break ;
394
+ }
395
+ }
396
+ }
397
+ }
398
+ void
399
+ ResolveExpr::visit (AST::InlineAsm &expr)
400
+ {
401
+ translate_operand (expr, prefix, canonical_prefix);
402
+ }
349
403
void
350
404
ResolveExpr::visit (AST::UnsafeBlockExpr &expr)
351
405
{
@@ -477,12 +531,13 @@ ResolveExpr::visit (AST::BreakExpr &expr)
477
531
auto &break_expr = expr.get_break_expr ();
478
532
if (break_expr.get_ast_kind () == AST::Kind::IDENTIFIER)
479
533
{
480
- /* This is a break with an expression, and the expression is just a
481
- single identifier. See if the identifier is either "rust" or
482
- "gcc", in which case we have "break rust" or "break gcc", and so
483
- may need to emit our funny error. We cannot yet emit the error
484
- here though, because the identifier may still be in scope, and
485
- ICE'ing on valid programs would not be very funny. */
534
+ /* This is a break with an expression, and the expression is
535
+ just a single identifier. See if the identifier is either
536
+ "rust" or "gcc", in which case we have "break rust" or "break
537
+ gcc", and so may need to emit our funny error. We cannot yet
538
+ emit the error here though, because the identifier may still
539
+ be in scope, and ICE'ing on valid programs would not be very
540
+ funny. */
486
541
std::string ident
487
542
= static_cast <AST::IdentifierExpr &> (break_expr).as_string ();
488
543
if (ident == " rust" || ident == " gcc" )
0 commit comments