Skip to content

Commit 0d71575

Browse files
csmoespastorino
authored andcommitted
impl mir visitor for NeoPlace
1 parent e5abf2a commit 0d71575

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

src/librustc/mir/visit.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ macro_rules! make_mir_visitor {
156156
self.super_place(place, context, location);
157157
}
158158

159+
fn visit_neoplace(
160+
&mut self,
161+
place: & $($mutability)* NeoPlace<'tcx>,
162+
context: PlaceContext<'tcx>,
163+
location: Location,
164+
) {
165+
self.super_neoplace(place, context, location);
166+
}
167+
159168
fn visit_static(&mut self,
160169
static_: & $($mutability)* Static<'tcx>,
161170
context: PlaceContext<'tcx>,
@@ -752,6 +761,40 @@ macro_rules! make_mir_visitor {
752761
}
753762
}
754763

764+
fn super_neoplace(
765+
&mut self,
766+
place: & $($mutability)* NeoPlace<'tcx>,
767+
context: PlaceContext<'tcx>,
768+
location: Location,
769+
) {
770+
let NeoPlace {
771+
base,
772+
elems,
773+
} = place;
774+
775+
match base {
776+
PlaceBase::Local(local) => {
777+
self.visit_local(local, context, location);
778+
}
779+
PlaceBase::Static(static_) => {
780+
self.visit_static(static_, context, location);
781+
}
782+
PlaceBase::Promoted(promoted) => {
783+
self.visit_ty(& $($mutability)* promoted.1, TyContext::Location(location));
784+
}
785+
}
786+
787+
if !elems.is_empty() {
788+
for elem in elems.iter().cloned().rev() {
789+
self.visit_projection_elem(
790+
&$($mutability)* elem.clone(),
791+
context,
792+
location
793+
);
794+
}
795+
}
796+
}
797+
755798
fn super_static(&mut self,
756799
static_: & $($mutability)* Static<'tcx>,
757800
_context: PlaceContext<'tcx>,

0 commit comments

Comments
 (0)