[PATCH] D147124: [lld][ELF][NFC] Simplify "Thunk *elf::addThunk()"

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 29 20:35:40 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf1f6ca582e22: [lld][ELF][NFC] Simplify method "Thunk *elf::addThunk()" (authored by benshi001).

Changed prior to commit:
  https://reviews.llvm.org/D147124?vs=509251&id=509542#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147124/new/

https://reviews.llvm.org/D147124

Files:
  lld/ELF/Thunks.cpp


Index: lld/ELF/Thunks.cpp
===================================================================
--- lld/ELF/Thunks.cpp
+++ lld/ELF/Thunks.cpp
@@ -1313,20 +1313,18 @@
   Symbol &s = *rel.sym;
   int64_t a = rel.addend;
 
-  if (config->emachine == EM_AARCH64)
+  switch (config->emachine) {
+  case EM_AARCH64:
     return addThunkAArch64(rel.type, s, a);
-
-  if (config->emachine == EM_ARM)
+  case EM_ARM:
     return addThunkArm(rel.type, s, a);
-
-  if (config->emachine == EM_MIPS)
+  case EM_MIPS:
     return addThunkMips(rel.type, s);
-
-  if (config->emachine == EM_PPC)
+  case EM_PPC:
     return addThunkPPC32(isec, rel, s);
-
-  if (config->emachine == EM_PPC64)
+  case EM_PPC64:
     return addThunkPPC64(rel.type, s, a);
-
-  llvm_unreachable("add Thunk only supported for ARM, Mips and PowerPC");
+  default:
+    llvm_unreachable("add Thunk only supported for ARM, Mips and PowerPC");
+  }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147124.509542.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230330/70e821f3/attachment.bin>


More information about the llvm-commits mailing list