diff options
author | Heejin Ahn <aheejin@gmail.com> | 2018-12-08 06:16:13 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2018-12-08 06:16:13 +0000 |
commit | a2125b8d9953e3720e9a9ec621ccbfd5f2cd78f0 (patch) | |
tree | 00cb47c50f1b46c5e8ac9f05f17e95d5ffb2d6a7 /llvm/lib/Object | |
parent | fe5a6c315be58370b06cd41a1067255d7bbacc52 (diff) | |
download | bcm5719-llvm-a2125b8d9953e3720e9a9ec621ccbfd5f2cd78f0.tar.gz bcm5719-llvm-a2125b8d9953e3720e9a9ec621ccbfd5f2cd78f0.zip |
[WebAssembly] Make WasmSymbol's signature usable for events (NFC)
Summary:
WasmSignature used to use its `WasmSignature` member variable only for
function types, but now it also can be used for events as well.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D55247
llvm-svn: 348702
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r-- | llvm/lib/Object/WasmObjectFile.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp index e756007fb21..895d45c470f 100644 --- a/llvm/lib/Object/WasmObjectFile.cpp +++ b/llvm/lib/Object/WasmObjectFile.cpp @@ -468,7 +468,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { while (Count--) { wasm::WasmSymbolInfo Info; - const wasm::WasmSignature *FunctionType = nullptr; + const wasm::WasmSignature *Signature = nullptr; const wasm::WasmGlobalType *GlobalType = nullptr; const wasm::WasmEventType *EventType = nullptr; @@ -486,13 +486,13 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { if (IsDefined) { Info.Name = readString(Ctx); unsigned FuncIndex = Info.ElementIndex - NumImportedFunctions; - FunctionType = &Signatures[FunctionTypes[FuncIndex]]; + Signature = &Signatures[FunctionTypes[FuncIndex]]; wasm::WasmFunction &Function = Functions[FuncIndex]; if (Function.SymbolName.empty()) Function.SymbolName = Info.Name; } else { wasm::WasmImport &Import = *ImportedFunctions[Info.ElementIndex]; - FunctionType = &Signatures[Import.SigIndex]; + Signature = &Signatures[Import.SigIndex]; Info.Name = Import.Field; Info.Module = Import.Module; } @@ -565,6 +565,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { Info.Name = readString(Ctx); unsigned EventIndex = Info.ElementIndex - NumImportedEvents; wasm::WasmEvent &Event = Events[EventIndex]; + Signature = &Signatures[Event.Type.SigIndex]; EventType = &Event.Type; if (Event.SymbolName.empty()) Event.SymbolName = Info.Name; @@ -572,6 +573,7 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { } else { wasm::WasmImport &Import = *ImportedEvents[Info.ElementIndex]; EventType = &Import.Event; + Signature = &Signatures[EventType->SigIndex]; Info.Name = Import.Field; } break; @@ -589,8 +591,8 @@ Error WasmObjectFile::parseLinkingSectionSymtab(ReadContext &Ctx) { Twine(Info.Name), object_error::parse_failed); LinkingData.SymbolTable.emplace_back(Info); - Symbols.emplace_back(LinkingData.SymbolTable.back(), FunctionType, - GlobalType, EventType); + Symbols.emplace_back(LinkingData.SymbolTable.back(), GlobalType, EventType, + Signature); LLVM_DEBUG(dbgs() << "Adding symbol: " << Symbols.back() << "\n"); } |