aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/WasmObjectFile.cpp
diff options
context:
space:
mode:
authorNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-04-20 17:07:24 +0000
committerNicholas Wilson <nicholas@nicholaswilson.me.uk>2018-04-20 17:07:24 +0000
commitef90ff36daa5f244357e29dd28e7d5092d01be76 (patch)
tree45be07814aff21b95287ebc2ccb06fe4cf890e88 /llvm/lib/Object/WasmObjectFile.cpp
parent4306f2086fe838591f2d1fe041ef73b643aa99ee (diff)
downloadllvm-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.cpp21
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;