File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,24 @@ struct IString {
8888 return startsWith (std::string_view (str));
8989 }
9090
91+ bool endsWith (std::string_view suffix) const {
92+ // TODO: Use C++20 `ends_with`.
93+ if (suffix.size () > str.size ()) {
94+ return false ;
95+ }
96+ return str.substr (str.size () - suffix.size ()) == suffix;
97+ }
98+ bool endsWith (IString str) const { return endsWith (str.str ); }
99+
100+ // Disambiguate for string literals.
101+ template <int N> bool endsWith (const char (&str)[N]) const {
102+ return endsWith (std::string_view (str));
103+ }
104+
105+ IString substr (size_t pos, size_t len = std::string_view::npos) const {
106+ return IString (str.substr (pos, len));
107+ }
108+
91109 size_t size () const { return str.size (); }
92110};
93111
Original file line number Diff line number Diff line change @@ -419,6 +419,9 @@ void multiSplitModule(const WasmSplitOptions& options) {
419419 }
420420 Name name = WasmBinaryReader::escape (line);
421421 if (newSection) {
422+ if (name.endsWith (" :" )) {
423+ name = name.substr (0 , name.size () - 1 );
424+ }
422425 if (moduleNameSet.count (name)) {
423426 Fatal () << " Module name " << name << " is listed more than once\n " ;
424427 }
Original file line number Diff line number Diff line change 1- 1
1+ 1:
22A
33
4- 2
4+ 2:
55B
66
7- 3
7+ 3:
88C
You can’t perform that action at this time.
0 commit comments