diff options
Diffstat (limited to 'COFF/Symbols.cpp')
-rw-r--r-- | COFF/Symbols.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/COFF/Symbols.cpp b/COFF/Symbols.cpp index 993e920ce7f76..5c185a511dd76 100644 --- a/COFF/Symbols.cpp +++ b/COFF/Symbols.cpp @@ -61,16 +61,19 @@ COFFSymbolRef DefinedCOFF::getCOFFSymbol() { return COFFSymbolRef(reinterpret_cast<const coff_symbol32 *>(Sym)); } +static Chunk *makeImportThunk(DefinedImportData *S, uint16_t Machine) { + if (Machine == AMD64) + return make<ImportThunkChunkX64>(S); + if (Machine == I386) + return make<ImportThunkChunkX86>(S); + assert(Machine == ARMNT); + return make<ImportThunkChunkARM>(S); +} + DefinedImportThunk::DefinedImportThunk(StringRef Name, DefinedImportData *S, uint16_t Machine) - : Defined(DefinedImportThunkKind, Name) { - switch (Machine) { - case AMD64: Data = make<ImportThunkChunkX64>(S); return; - case I386: Data = make<ImportThunkChunkX86>(S); return; - case ARMNT: Data = make<ImportThunkChunkARM>(S); return; - default: llvm_unreachable("unknown machine type"); - } -} + : Defined(DefinedImportThunkKind, Name), WrappedSym(S), + Data(makeImportThunk(S, Machine)) {} Defined *Undefined::getWeakAlias() { // A weak alias may be a weak alias to another symbol, so check recursively. |