Add comments to DataContext's import_function and import_global_var.

These are the main obvious place where ExternalName is exposed in the
Module API, so add comments advising users that they can use Module to
call these functions with the appropriate ExternalNames automatically.
This commit is contained in:
Dan Gohman
2018-04-20 16:36:08 -07:00
parent dfb24f1934
commit 7079c72b28

View File

@@ -104,6 +104,10 @@ impl DataContext {
}
/// Declare an external function import.
///
/// Users of the `Module` API generally should call
/// `Module::declare_func_in_data` instead, as it takes care of generating
/// the appropriate `ExternalName`.
pub fn import_function(&mut self, name: ir::ExternalName) -> ir::FuncRef {
self.description.function_decls.push(name)
}
@@ -111,6 +115,10 @@ impl DataContext {
/// Declares a global variable import.
///
/// TODO: Rename to import_data?
///
/// Users of the `Module` API generally should call
/// `Module::declare_data_in_data` instead, as it takes care of generating
/// the appropriate `ExternalName`.
pub fn import_global_var(&mut self, name: ir::ExternalName) -> ir::GlobalVar {
self.description.data_decls.push(name)
}