[llvm] 5565820 - Use range-for in MCAssembler [NFC]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 14:57:41 PST 2020


Author: Philip Reames
Date: 2020-03-02T14:57:35-08:00
New Revision: 5565820e6e413d13d210c28850fc31ecfbb64202

URL: https://github.com/llvm/llvm-project/commit/5565820e6e413d13d210c28850fc31ecfbb64202
DIFF: https://github.com/llvm/llvm-project/commit/5565820e6e413d13d210c28850fc31ecfbb64202.diff

LOG: Use range-for in MCAssembler [NFC]

Added: 
    

Modified: 
    llvm/lib/MC/MCAssembler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 8582d5143aa8..ca202ddf03d7 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -1127,11 +1127,11 @@ bool MCAssembler::layoutSectionOnce(MCAsmLayout &Layout, MCSection &Sec) {
   MCFragment *FirstRelaxedFragment = nullptr;
 
   // Attempt to relax all the fragments in the section.
-  for (MCSection::iterator I = Sec.begin(), IE = Sec.end(); I != IE; ++I) {
+  for (MCFragment &Frag : Sec) {
     // Check if this is a fragment that needs relaxation.
-    bool RelaxedFrag = relaxFragment(Layout, *I);
+    bool RelaxedFrag = relaxFragment(Layout, Frag);
     if (RelaxedFrag && !FirstRelaxedFragment)
-      FirstRelaxedFragment = &*I;
+      FirstRelaxedFragment = &Frag;
   }
   if (FirstRelaxedFragment) {
     Layout.invalidateFragmentsFrom(FirstRelaxedFragment);
@@ -1144,8 +1144,7 @@ bool MCAssembler::layoutOnce(MCAsmLayout &Layout) {
   ++stats::RelaxationSteps;
 
   bool WasRelaxed = false;
-  for (iterator it = begin(), ie = end(); it != ie; ++it) {
-    MCSection &Sec = *it;
+  for (MCSection &Sec : *this) {
     while (layoutSectionOnce(Layout, Sec))
       WasRelaxed = true;
   }


        


More information about the llvm-commits mailing list