summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-03-02 21:19:55 +0000
committerRui Ueyama <ruiu@google.com>2018-03-02 21:19:55 +0000
commite89b0ef0a0ad3a5ff18c1d9bffd417f8870cfc9a (patch)
tree9525517ab73d9740987a579205da5df1231cdce6
parent0c69a3e3d94f261344f0a9a6cc89cf7af6b95ef1 (diff)
downloadbcm5719-llvm-e89b0ef0a0ad3a5ff18c1d9bffd417f8870cfc9a.tar.gz
bcm5719-llvm-e89b0ef0a0ad3a5ff18c1d9bffd417f8870cfc9a.zip
[WebAssembly] Simplify createDefined. NFC.
Differential Revision: https://reviews.llvm.org/D43849 llvm-svn: 326615
-rw-r--r--lld/wasm/InputFiles.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp
index fab6db2be89..2c65c7bfd5c 100644
--- a/lld/wasm/InputFiles.cpp
+++ b/lld/wasm/InputFiles.cpp
@@ -175,6 +175,9 @@ Symbol *ObjFile::createDefined(const WasmSymbol &Sym) {
if (!Sym.isDefined())
return nullptr;
+ StringRef Name = Sym.Info.Name;
+ uint32_t Flags = Sym.Info.Flags;
+
switch (Sym.Info.Kind) {
case WASM_SYMBOL_TYPE_FUNCTION: {
InputFunction *Func =
@@ -185,9 +188,8 @@ Symbol *ObjFile::createDefined(const WasmSymbol &Sym) {
}
if (Sym.isBindingLocal())
- return make<DefinedFunction>(Sym.Info.Name, Sym.Info.Flags, this, Func);
- return Symtab->addDefinedFunction(Sym.Info.Name, Sym.Info.Flags, this,
- Func);
+ return make<DefinedFunction>(Name, Flags, this, Func);
+ return Symtab->addDefinedFunction(Name, Flags, this, Func);
}
case WASM_SYMBOL_TYPE_DATA: {
InputSegment *Seg = Segments[Sym.Info.DataRef.Segment];
@@ -200,18 +202,15 @@ Symbol *ObjFile::createDefined(const WasmSymbol &Sym) {
uint32_t Size = Sym.Info.DataRef.Size;
if (Sym.isBindingLocal())
- return make<DefinedData>(Sym.Info.Name, Sym.Info.Flags, this, Seg, Offset,
- Size);
- return Symtab->addDefinedData(Sym.Info.Name, Sym.Info.Flags, this, Seg,
- Offset, Size);
+ return make<DefinedData>(Name, Flags, this, Seg, Offset, Size);
+ return Symtab->addDefinedData(Name, Flags, this, Seg, Offset, Size);
}
case WASM_SYMBOL_TYPE_GLOBAL:
InputGlobal *Global =
Globals[Sym.Info.ElementIndex - WasmObj->getNumImportedGlobals()];
if (Sym.isBindingLocal())
- return make<DefinedGlobal>(Sym.Info.Name, Sym.Info.Flags, this, Global);
- return Symtab->addDefinedGlobal(Sym.Info.Name, Sym.Info.Flags, this,
- Global);
+ return make<DefinedGlobal>(Name, Flags, this, Global);
+ return Symtab->addDefinedGlobal(Name, Flags, this, Global);
}
llvm_unreachable("unkown symbol kind");
}
OpenPOWER on IntegriCloud