From ef90ff36daa5f244357e29dd28e7d5092d01be76 Mon Sep 17 00:00:00 2001 From: Nicholas Wilson Date: Fri, 20 Apr 2018 17:07:24 +0000 Subject: [WebAssembly] Distinguish debug/symbol names in the Wasm structs. NFC Differential Revision: https://reviews.llvm.org/D45021 llvm-svn: 330448 --- llvm/lib/Object/WasmObjectFile.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'llvm/lib/Object/WasmObjectFile.cpp') diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index b9eba01..a9a6492 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -283,11 +283,8 @@ Error WasmObjectFile::parseNameSection(const uint8_t *Ptr, const uint8_t *End) { return make_error("Invalid name entry", object_error::parse_failed); DebugNames.push_back(wasm::WasmFunctionName{Index, Name}); - if (isDefinedFunctionIndex(Index)) { - // Override any existing name; the name specified by the "names" - // section is the Function's canonical name. - getDefinedFunction(Index).Name = Name; - } + if (isDefinedFunctionIndex(Index)) + getDefinedFunction(Index).DebugName = Name; } break; } @@ -409,11 +406,8 @@ Error WasmObjectFile::parseLinkingSectionSymtab(const uint8_t *&Ptr, unsigned FuncIndex = Info.ElementIndex - NumImportedFunctions; FunctionType = &Signatures[FunctionTypes[FuncIndex]]; wasm::WasmFunction &Function = Functions[FuncIndex]; - if (Function.Name.empty()) { - // Use the symbol's name to set a name for the Function, but only if - // one hasn't already been set. - Function.Name = Info.Name; - } + if (Function.SymbolName.empty()) + Function.SymbolName = Info.Name; } else { wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex]; FunctionType = &Signatures[Import.SigIndex]; @@ -437,11 +431,8 @@ Error WasmObjectFile::parseLinkingSectionSymtab(const uint8_t *&Ptr, unsigned GlobalIndex = Info.ElementIndex - NumImportedGlobals; wasm::WasmGlobal &Global = Globals[GlobalIndex]; GlobalType = &Global.Type; - if (Global.Name.empty()) { - // Use the symbol's name to set a name for the Global, but only if - // one hasn't already been set. - Global.Name = Info.Name; - } + if (Global.SymbolName.empty()) + Global.SymbolName = Info.Name; } else { wasm::WasmImport &Import = *ImportedGlobals[Info.ElementIndex]; Info.Name = Import.Field; -- cgit v1.1