Handle asm const similar to inline const
This commit is contained in:
parent
6e4adbed76
commit
f482460f92
11 changed files with 95 additions and 68 deletions
|
@ -459,4 +459,43 @@ impl<'a, 'ra, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'ra, 'tcx> {
|
|||
visit::walk_attribute(self, attr);
|
||||
self.in_attr = orig_in_attr;
|
||||
}
|
||||
|
||||
fn visit_inline_asm(&mut self, asm: &'a InlineAsm) {
|
||||
let InlineAsm {
|
||||
asm_macro: _,
|
||||
template: _,
|
||||
template_strs: _,
|
||||
operands,
|
||||
clobber_abis: _,
|
||||
options: _,
|
||||
line_spans: _,
|
||||
} = asm;
|
||||
for (op, _span) in operands {
|
||||
match op {
|
||||
InlineAsmOperand::In { expr, reg: _ }
|
||||
| InlineAsmOperand::Out { expr: Some(expr), reg: _, late: _ }
|
||||
| InlineAsmOperand::InOut { expr, reg: _, late: _ } => {
|
||||
self.visit_expr(expr);
|
||||
}
|
||||
InlineAsmOperand::Out { expr: None, reg: _, late: _ } => {}
|
||||
InlineAsmOperand::SplitInOut { in_expr, out_expr, reg: _, late: _ } => {
|
||||
self.visit_expr(in_expr);
|
||||
if let Some(expr) = out_expr {
|
||||
self.visit_expr(expr);
|
||||
}
|
||||
}
|
||||
InlineAsmOperand::Const { anon_const } => {
|
||||
let def = self.create_def(
|
||||
anon_const.id,
|
||||
kw::Empty,
|
||||
DefKind::InlineConst,
|
||||
anon_const.value.span,
|
||||
);
|
||||
self.with_parent(def, |this| visit::walk_anon_const(this, anon_const));
|
||||
}
|
||||
InlineAsmOperand::Sym { sym } => self.visit_inline_asm_sym(sym),
|
||||
InlineAsmOperand::Label { block } => self.visit_block(block),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue