-
Notifications
You must be signed in to change notification settings - Fork 279
mark extern block function signatures as FIXED #966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -321,6 +321,46 @@ where | |
} | ||
} | ||
|
||
fn mark_foreign_fixed<'tcx>( | ||
gacx: &mut GlobalAnalysisCtxt<'tcx>, | ||
gasn: &mut GlobalAssignment, | ||
tcx: TyCtxt<'tcx>, | ||
) { | ||
// FIX the inputs and outputs of function declarations in extern blocks | ||
for did in gacx.foreign_mentioned_tys.clone() { | ||
if let DefKind::Fn = tcx.def_kind(did) { | ||
let sig = tcx.erase_late_bound_regions(tcx.fn_sig(did)); | ||
let inputs = sig | ||
.inputs() | ||
.iter() | ||
.map(|&ty| gacx.assign_pointer_ids_with_info(ty, PointerInfo::ANNOTATED)) | ||
kkysen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
.collect::<Vec<_>>(); | ||
for input in inputs { | ||
make_ty_fixed(gasn, input); | ||
} | ||
|
||
let output = gacx.assign_pointer_ids_with_info(sig.output(), PointerInfo::ANNOTATED); | ||
make_ty_fixed(gasn, output) | ||
|
||
} | ||
} | ||
oinoom marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
// FIX the fields of structs mentioned in extern blocks | ||
for adt_did in &gacx.adt_metadata.struct_dids { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, it would be easier to review (though in this case, it's a simple change so it's not bad) if moves were separated from actual changes in separate commits. |
||
if gacx.foreign_mentioned_tys.contains(adt_did) { | ||
let adt_def = tcx.adt_def(adt_did); | ||
let fields = adt_def.all_fields(); | ||
for field in fields { | ||
let field_lty = gacx.field_ltys[&field.did]; | ||
eprintln!( | ||
"adding FIXED permission for {adt_did:?} field {:?}", | ||
field.did | ||
); | ||
make_ty_fixed(gasn, field_lty); | ||
} | ||
} | ||
} | ||
} | ||
|
||
fn run(tcx: TyCtxt) { | ||
let mut gacx = GlobalAnalysisCtxt::new(tcx); | ||
let mut func_info = HashMap::new(); | ||
|
@@ -529,21 +569,7 @@ fn run(tcx: TyCtxt) { | |
} | ||
} | ||
|
||
// FIX the fields of structs mentioned in extern blocks | ||
for adt_did in &gacx.adt_metadata.struct_dids { | ||
if gacx.foreign_mentioned_tys.contains(adt_did) { | ||
let adt_def = tcx.adt_def(adt_did); | ||
let fields = adt_def.all_fields(); | ||
for field in fields { | ||
let field_lty = gacx.field_ltys[&field.did]; | ||
eprintln!( | ||
"adding FIXED permission for {adt_did:?} field {:?}", | ||
field.did | ||
); | ||
make_ty_fixed(&mut gasn, field_lty); | ||
} | ||
} | ||
} | ||
mark_foreign_fixed(&mut gacx, &mut gasn, tcx); | ||
|
||
for info in func_info.values_mut() { | ||
let num_pointers = info.acx_data.num_pointers(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.