diff options
Diffstat (limited to 'src/passes/Strip.cpp')
-rw-r--r-- | src/passes/Strip.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/passes/Strip.cpp b/src/passes/Strip.cpp index 8ab712cb1..40e5a9e9d 100644 --- a/src/passes/Strip.cpp +++ b/src/passes/Strip.cpp @@ -47,11 +47,15 @@ struct Strip : public Pass { ), sections.end() ); - // Clean up internal data structures. - module->clearDebugInfo(); - for (auto& func : module->functions) { - func->clearNames(); - func->clearDebugInfo(); + // If we're cleaning up debug info, clear on the function and module too. + UserSection temp; + temp.name = BinaryConsts::UserSections::Name; + if (decider(temp)) { + module->clearDebugInfo(); + for (auto& func : module->functions) { + func->clearNames(); + func->clearDebugInfo(); + } } } }; @@ -71,4 +75,9 @@ Pass *createStripProducersPass() { }); } +Pass *createStripTargetFeaturesPass() { + return new Strip([&](const UserSection& curr) { + return curr.name == BinaryConsts::UserSections::TargetFeatures; + }); +} } // namespace wasm |