[lld] r321734 - Use a swtich. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 08:29:44 PST 2018


Author: rafael
Date: Wed Jan  3 08:29:43 2018
New Revision: 321734

URL: http://llvm.org/viewvc/llvm-project?rev=321734&view=rev
Log:
Use a swtich. NFC.

Modified:
    lld/trunk/ELF/Relocations.cpp

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=321734&r1=321733&r2=321734&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Jan  3 08:29:43 2018
@@ -410,13 +410,16 @@ static RelExpr toPlt(RelExpr Expr) {
 static RelExpr fromPlt(RelExpr Expr) {
   // We decided not to use a plt. Optimize a reference to the plt to a
   // reference to the symbol itself.
-  if (Expr == R_PLT_PC)
+  switch (Expr) {
+  case R_PLT_PC:
     return R_PC;
-  if (Expr == R_PPC_PLT_OPD)
+  case R_PPC_PLT_OPD:
     return R_PPC_OPD;
-  if (Expr == R_PLT)
+  case R_PLT:
     return R_ABS;
-  return Expr;
+  default:
+    return Expr;
+  }
 }
 
 // Returns true if a given shared symbol is in a read-only segment in a DSO.




More information about the llvm-commits mailing list