diff options
Diffstat (limited to 'src/decompiler-naming.h')
-rw-r--r-- | src/decompiler-naming.h | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/decompiler-naming.h b/src/decompiler-naming.h index 155da009..91f841f8 100644 --- a/src/decompiler-naming.h +++ b/src/decompiler-naming.h @@ -26,7 +26,7 @@ namespace wabt { inline void RenameToIdentifier(std::string& name, Index i, BindingHash& bh, - const std::set<string_view>* filter) { + const std::set<std::string_view>* filter) { // Filter out non-identifier characters, and try to reduce the size of // gigantic C++ signature names. std::string s; @@ -67,7 +67,8 @@ inline void RenameToIdentifier(std::string& name, word_end--; } assert(word_end > word_start); - auto word = string_view(s.c_str() + word_start, word_end - word_start); + auto word = + std::string_view(s.c_str() + word_start, word_end - word_start); if (filter->find(word) != filter->end()) { s.resize(word_start); } @@ -107,7 +108,7 @@ inline void RenameToIdentifier(std::string& name, template <typename T> void RenameToIdentifiers(std::vector<T*>& things, BindingHash& bh, - const std::set<string_view>* filter) { + const std::set<std::string_view>* filter) { Index i = 0; for (auto thing : things) { RenameToIdentifier(thing->name, i++, bh, filter); @@ -174,22 +175,10 @@ void RenameAll(Module& module) { // We also filter common C++ keywords/STL idents that make for huge // identifiers. // FIXME: this can obviously give bad results if the input is not C++.. - std::set<string_view> filter = { - { "const" }, - { "std" }, - { "allocator" }, - { "char" }, - { "basic" }, - { "traits" }, - { "wchar" }, - { "t" }, - { "void" }, - { "int" }, - { "unsigned" }, - { "2" }, - { "cxxabiv1" }, - { "short" }, - { "4096ul" }, + std::set<std::string_view> filter = { + {"const"}, {"std"}, {"allocator"}, {"char"}, {"basic"}, + {"traits"}, {"wchar"}, {"t"}, {"void"}, {"int"}, + {"unsigned"}, {"2"}, {"cxxabiv1"}, {"short"}, {"4096ul"}, }; RenameToIdentifiers(module.funcs, module.func_bindings, &filter); // Also do this for some other kinds of names, but without the keyword |