diff options
author | Sam Clegg <sbc@chromium.org> | 2018-01-17 19:28:43 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2018-01-17 19:28:43 +0000 |
commit | 9f3fe42e19e693c59295abeb5a1d9463140ccaae (patch) | |
tree | 6efe7982cccc29f8a26b2c395c3fbc264efc9eb9 /llvm/tools/obj2yaml/wasm2yaml.cpp | |
parent | d122baec226e438031e56efa398f666d80a39b74 (diff) | |
download | llvm-9f3fe42e19e693c59295abeb5a1d9463140ccaae.zip llvm-9f3fe42e19e693c59295abeb5a1d9463140ccaae.tar.gz llvm-9f3fe42e19e693c59295abeb5a1d9463140ccaae.tar.bz2 |
[WebAssembly] Remove debug names from symbol table
Get rid of DEBUG_FUNCTION_NAME symbols. When we actually debug
data, maybe we'll want somewhere to put it... but having a symbol
that just stores the name of another symbol seems odd.
It means you have multiple Symbols with the same name, one
containing the actual function and another containing the name!
Store the names in a vector on the WasmObjectFile when reading
them in. Also stash them on the WasmFunctions themselves.
The names are //not// "symbol names" or aliases or anything,
they're just the name that a debugger should show against the
function body itself. NB. The WasmObjectFile stores them so that
they can be exported in the YAML losslessly, and hence the tests
can be precise.
Enforce that the CODE section has been read in before reading
the "names" section. Requires minor adjustment to some tests.
Patch by Nicholas Wilson!
Differential Revision: https://reviews.llvm.org/D42075
llvm-svn: 322741
Diffstat (limited to 'llvm/tools/obj2yaml/wasm2yaml.cpp')
-rw-r--r-- | llvm/tools/obj2yaml/wasm2yaml.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/tools/obj2yaml/wasm2yaml.cpp b/llvm/tools/obj2yaml/wasm2yaml.cpp index e3577d4..7ec344a 100644 --- a/llvm/tools/obj2yaml/wasm2yaml.cpp +++ b/llvm/tools/obj2yaml/wasm2yaml.cpp @@ -53,13 +53,10 @@ std::unique_ptr<WasmYAML::CustomSection> WasmDumper::dumpCustomSection(const Was std::unique_ptr<WasmYAML::CustomSection> CustomSec; if (WasmSec.Name == "name") { std::unique_ptr<WasmYAML::NameSection> NameSec = make_unique<WasmYAML::NameSection>(); - for (const object::SymbolRef& Sym: Obj.symbols()) { - const object::WasmSymbol Symbol = Obj.getWasmSymbol(Sym); - if (Symbol.Type != object::WasmSymbol::SymbolType::DEBUG_FUNCTION_NAME) - continue; + for (const llvm::wasm::WasmFunctionName &Func: Obj.debugNames()) { WasmYAML::NameEntry NameEntry; - NameEntry.Name = Symbol.Name; - NameEntry.Index = Sym.getValue(); + NameEntry.Name = Func.Name; + NameEntry.Index = Func.Index; NameSec->FunctionNames.push_back(NameEntry); } CustomSec = std::move(NameSec); |