summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-12-07 12:41:55 -0800
committerGitHub <noreply@github.com>2018-12-07 12:41:55 -0800
commitc26a403c3049e2a861cccdfdb126a9ac693205c8 (patch)
tree4ae4f09adf8a424fe656b372166d67723e65ee3f /src
parent366e52e9913fc480e2d0ec20281ae788e4d5ccd5 (diff)
downloadbinaryen-c26a403c3049e2a861cccdfdb126a9ac693205c8.tar.gz
binaryen-c26a403c3049e2a861cccdfdb126a9ac693205c8.tar.bz2
binaryen-c26a403c3049e2a861cccdfdb126a9ac693205c8.zip
Fix comment in src/ir/module-utils.h (#1810)
Followup from #1808
Diffstat (limited to 'src')
-rw-r--r--src/ir/module-utils.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ir/module-utils.h b/src/ir/module-utils.h
index a77adf293..c03015f41 100644
--- a/src/ir/module-utils.h
+++ b/src/ir/module-utils.h
@@ -131,13 +131,15 @@ inline void copyModule(Module& in, Module& out) {
// Renaming
+// Rename functions along with all their uses.
+// Note that for this to work the functions themselves don't necessarily need
+// to exist. For example, it is possible to remove a given function and then
+// call this redirect all of its uses.
template<typename T>
inline void renameFunctions(Module& wasm, T& map) {
// Update the function itself.
for (auto& pair : map) {
if (Function* F = wasm.getFunctionOrNull(pair.first)) {
- // In some cases t he function itself might have been removed already
- // and we just want to rename all its (now invalid) uses.
assert(!wasm.getFunctionOrNull(pair.second));
F->name = pair.second;
}