[lld] r326615 - [WebAssembly] Simplify createDefined. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 2 13:19:55 PST 2018
Author: ruiu
Date: Fri Mar 2 13:19:55 2018
New Revision: 326615
URL: http://llvm.org/viewvc/llvm-project?rev=326615&view=rev
Log:
[WebAssembly] Simplify createDefined. NFC.
Differential Revision: https://reviews.llvm.org/D43849
Modified:
lld/trunk/wasm/InputFiles.cpp
Modified: lld/trunk/wasm/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputFiles.cpp?rev=326615&r1=326614&r2=326615&view=diff
==============================================================================
--- lld/trunk/wasm/InputFiles.cpp (original)
+++ lld/trunk/wasm/InputFiles.cpp Fri Mar 2 13:19:55 2018
@@ -175,6 +175,9 @@ Symbol *ObjFile::createDefined(const Was
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 Was
}
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 Was
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");
}
More information about the llvm-commits
mailing list