summaryrefslogtreecommitdiff
path: root/src/generate-names.cc
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2020-01-27 14:05:21 -0800
committerGitHub <noreply@github.com>2020-01-27 14:05:21 -0800
commitac29d4f571f54ce3c99243048ebdac6cfe6cc671 (patch)
tree326acb7841b6092f007744fe55a2c48f98d77ca8 /src/generate-names.cc
parent2132abdd621a354a25af6bc67d1bb603c6b3c4dc (diff)
downloadwabt-ac29d4f571f54ce3c99243048ebdac6cfe6cc671.tar.gz
wabt-ac29d4f571f54ce3c99243048ebdac6cfe6cc671.tar.bz2
wabt-ac29d4f571f54ce3c99243048ebdac6cfe6cc671.zip
wasm-decompile: use symbols from linking section for names. (#1318)
This allows wasm .o files to have more readable names, or even final linked modules if the linking information is preserved (with e.g. --emit-relocs in LLD). This is implemented as part of the WABT IR representation, so benefits wasm2wat as well. Named obtained this way are only set for functions if the function doesn't also have a name in the name section, but is preferred over the export name if there is one.
Diffstat (limited to 'src/generate-names.cc')
-rw-r--r--src/generate-names.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/generate-names.cc b/src/generate-names.cc
index 0e140f5f..e615d471 100644
--- a/src/generate-names.cc
+++ b/src/generate-names.cc
@@ -120,8 +120,7 @@ void NameGenerator::GenerateName(const char* prefix,
Index index,
unsigned disambiguator,
std::string* str) {
- str->clear();
- if (!(opts_ & NameOpts::NoDollar)) *str = "$";
+ *str = "$";
*str += prefix;
if (index != kInvalidIndex) {
if (opts_ & NameOpts::AlphaNames) {