r250881 - Use range-based for loops. NFC.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 20 21:52:40 PDT 2015
Author: ctopper
Date: Tue Oct 20 23:52:40 2015
New Revision: 250881
URL: http://llvm.org/viewvc/llvm-project?rev=250881&view=rev
Log:
Use range-based for loops. NFC.
Modified:
cfe/trunk/lib/Basic/TargetInfo.cpp
Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=250881&r1=250880&r2=250881&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Oct 20 23:52:40 2015
@@ -368,27 +368,24 @@ bool TargetInfo::isValidGCCRegisterName(
return true;
// Check any additional names that we have.
- ArrayRef<AddlRegName> AddlNames = getGCCAddlRegNames();
- for (unsigned i = 0; i < AddlNames.size(); i++)
- for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
- if (!AddlNames[i].Names[j])
+ for (const AddlRegName &ARN : getGCCAddlRegNames())
+ for (const char *AN : ARN.Names) {
+ if (!AN)
break;
// Make sure the register that the additional name is for is within
// the bounds of the register names from above.
- if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < Names.size())
+ if (AN == Name && ARN.RegNum < Names.size())
return true;
- }
+ }
// Now check aliases.
- ArrayRef<GCCRegAlias> Aliases = getGCCRegAliases();
- for (unsigned i = 0; i < Aliases.size(); i++) {
- for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
- if (!Aliases[i].Aliases[j])
+ for (const GCCRegAlias &GRA : getGCCRegAliases())
+ for (const char *A : GRA.Aliases) {
+ if (!A)
break;
- if (Aliases[i].Aliases[j] == Name)
+ if (A == Name)
return true;
}
- }
return false;
}
@@ -412,27 +409,24 @@ TargetInfo::getNormalizedGCCRegisterName
}
// Check any additional names that we have.
- ArrayRef<AddlRegName> AddlNames = getGCCAddlRegNames();
- for (unsigned i = 0; i < AddlNames.size(); i++)
- for (unsigned j = 0; j < llvm::array_lengthof(AddlNames[i].Names); j++) {
- if (!AddlNames[i].Names[j])
+ for (const AddlRegName &ARN : getGCCAddlRegNames())
+ for (const char *AN : ARN.Names) {
+ if (!AN)
break;
// Make sure the register that the additional name is for is within
// the bounds of the register names from above.
- if (AddlNames[i].Names[j] == Name && AddlNames[i].RegNum < Names.size())
+ if (AN == Name && ARN.RegNum < Names.size())
return Name;
}
// Now check aliases.
- ArrayRef<GCCRegAlias> Aliases = getGCCRegAliases();
- for (unsigned i = 0; i < Aliases.size(); i++) {
- for (unsigned j = 0 ; j < llvm::array_lengthof(Aliases[i].Aliases); j++) {
- if (!Aliases[i].Aliases[j])
+ for (const GCCRegAlias &RA : getGCCRegAliases())
+ for (const char *A : RA.Aliases) {
+ if (!A)
break;
- if (Aliases[i].Aliases[j] == Name)
- return Aliases[i].Register;
+ if (A == Name)
+ return RA.Register;
}
- }
return Name;
}
More information about the cfe-commits
mailing list