From 7079c72b28e3f2ef53cc046f2adbf82f14c270d8 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 20 Apr 2018 16:36:08 -0700 Subject: [PATCH] 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. --- lib/module/src/data_context.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/module/src/data_context.rs b/lib/module/src/data_context.rs index 51eac88b79..9e9f823383 100644 --- a/lib/module/src/data_context.rs +++ b/lib/module/src/data_context.rs @@ -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) }