]> granicus.if.org Git - clang/commitdiff
Basic: use range-based for loops for ARM target
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 17 Sep 2014 14:50:23 +0000 (14:50 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 17 Sep 2014 14:50:23 +0000 (14:50 +0000)
Tweak handleTargetFeature for the ARM(32) target to use range based for loops.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217956 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp

index ce270093937934084c04fe3d86aee373d51f71ae..e026d0f828d4ebe224844c67d7698a509a76e6a0 100644 (file)
@@ -3841,28 +3841,29 @@ public:
     Crypto = 0;
     SoftFloat = SoftFloatABI = false;
     HWDiv = 0;
-    for (unsigned i = 0, e = Features.size(); i != e; ++i) {
-      if (Features[i] == "+soft-float")
+
+    for (const auto &Feature : Features) {
+      if (Feature == "+soft-float")
         SoftFloat = true;
-      else if (Features[i] == "+soft-float-abi")
+      else if (Feature == "+soft-float-abi")
         SoftFloatABI = true;
-      else if (Features[i] == "+vfp2")
+      else if (Feature == "+vfp2")
         FPU |= VFP2FPU;
-      else if (Features[i] == "+vfp3")
+      else if (Feature == "+vfp3")
         FPU |= VFP3FPU;
-      else if (Features[i] == "+vfp4")
+      else if (Feature == "+vfp4")
         FPU |= VFP4FPU;
-      else if (Features[i] == "+fp-armv8")
+      else if (Feature == "+fp-armv8")
         FPU |= FPARMV8;
-      else if (Features[i] == "+neon")
+      else if (Feature == "+neon")
         FPU |= NeonFPU;
-      else if (Features[i] == "+hwdiv")
+      else if (Feature == "+hwdiv")
         HWDiv |= HWDivThumb;
-      else if (Features[i] == "+hwdiv-arm")
+      else if (Feature == "+hwdiv-arm")
         HWDiv |= HWDivARM;
-      else if (Features[i] == "+crc")
+      else if (Feature == "+crc")
         CRC = 1;
-      else if (Features[i] == "+crypto")
+      else if (Feature == "+crypto")
         Crypto = 1;
     }
 
@@ -3877,13 +3878,13 @@ public:
       Features.push_back("-neonfp");
 
     // Remove front-end specific options which the backend handles differently.
-    std::vector<std::string>::iterator it;
-    it = std::find(Features.begin(), Features.end(), "+soft-float");
-    if (it != Features.end())
-      Features.erase(it);
-    it = std::find(Features.begin(), Features.end(), "+soft-float-abi");
-    if (it != Features.end())
-      Features.erase(it);
+    const StringRef FrontEndFeatures[] = { "+soft-float", "+soft-float-abi" };
+    for (const auto &FEFeature : FrontEndFeatures) {
+      auto Feature = std::find(Features.begin(), Features.end(), FEFeature);
+      if (Feature != Features.end())
+        Features.erase(Feature);
+    }
+
     return true;
   }