[TableGen] Use range-based for loops. NFC
authorCraig Topper <craig.topper@gmail.com>
Wed, 30 Dec 2015 06:00:20 +0000 (06:00 +0000)
committerCraig Topper <craig.topper@gmail.com>
Wed, 30 Dec 2015 06:00:20 +0000 (06:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256626 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmMatcherEmitter.cpp

index 7bcce06a696512f2625c907f58066797e90f0ba6..a6b5fb39eb394d9ba2f5580fb77c1e5f1afd30c9 100644 (file)
@@ -989,8 +989,8 @@ bool MatchableInfo::validate(StringRef CommentDelimiter, bool Hack) const {
   // Also, check for instructions which reference the operand multiple times;
   // this implies a constraint we would not honor.
   std::set<std::string> OperandNames;
-  for (unsigned i = 0, e = AsmOperands.size(); i != e; ++i) {
-    StringRef Tok = AsmOperands[i].Token;
+  for (const AsmOperand &Op : AsmOperands) {
+    StringRef Tok = Op.Token;
     if (Tok[0] == '$' && Tok.find(':') != StringRef::npos)
       PrintFatalError(TheDef->getLoc(),
                       "matchable with operand modifier '" + Tok +
@@ -2146,8 +2146,8 @@ static void emitIsSubclass(CodeGenTarget &Target,
     if (!SuperClasses.empty()) {
       SS << "    switch (B) {\n";
       SS << "    default: return false;\n";
-      for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
-        SS << "    case " << SuperClasses[i].str() << ": return true;\n";
+      for (StringRef SC : SuperClasses)
+        SS << "    case " << SC << ": return true;\n";
       SS << "    }\n";
     } else {
       // No case statement to emit