[lld] r260320 - Rangefy, and replace a switch with `if`s. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 15:11:21 PST 2016


Author: ruiu
Date: Tue Feb  9 17:11:21 2016
New Revision: 260320

URL: http://llvm.org/viewvc/llvm-project?rev=260320&view=rev
Log:
Rangefy, and replace a switch with `if`s. NFC.

Modified:
    lld/trunk/ELF/OutputSections.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=260320&r1=260319&r2=260320&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Feb  9 17:11:21 2016
@@ -943,21 +943,20 @@ uint8_t EHOutputSection<ELFT>::getFdeEnc
   // We only care about an 'R' value, but other records may precede an 'R'
   // record. Records are not in TLV (type-length-value) format, so we need
   // to teach the linker how to skip records for each type.
-  for (; !Aug.empty(); Aug = Aug.substr(1)) {
-    switch (Aug[0]) {
-    case 'z':
-      skipLeb128(D);
-      break;
-    case 'R':
+  for (char C : Aug) {
+    if (C == 'R')
       return readByte(D);
-    case 'P':
+    if (C == 'z') {
+      skipLeb128(D);
+      continue;
+    }
+    if (C == 'P') {
       skipAugP<ELFT>(D);
-      break;
-    case 'L':
-      break;
-    default:
-      fatal("unknown .eh_frame augmentation string: " + Aug);
+      continue;
     }
+    if (C == 'L')
+      continue;
+    fatal("unknown .eh_frame augmentation string: " + Aug);
   }
   return DW_EH_PE_absptr;
 }




More information about the llvm-commits mailing list