diff options
author | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-04-20 17:07:24 +0000 |
---|---|---|
committer | Nicholas Wilson <nicholas@nicholaswilson.me.uk> | 2018-04-20 17:07:24 +0000 |
commit | ef90ff36daa5f244357e29dd28e7d5092d01be76 (patch) | |
tree | 45be07814aff21b95287ebc2ccb06fe4cf890e88 /llvm/lib/Object/WasmObjectFile.cpp | |
parent | 4306f2086fe838591f2d1fe041ef73b643aa99ee (diff) | |
download | llvm-ef90ff36daa5f244357e29dd28e7d5092d01be76.zip llvm-ef90ff36daa5f244357e29dd28e7d5092d01be76.tar.gz llvm-ef90ff36daa5f244357e29dd28e7d5092d01be76.tar.bz2 |
[WebAssembly] Distinguish debug/symbol names in the Wasm structs. NFC
Differential Revision: https://reviews.llvm.org/D45021
llvm-svn: 330448
Diffstat (limited to 'llvm/lib/Object/WasmObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
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<GenericBinaryError>("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; |