ArrayRef<SMRange> getSuperClassRanges() const { return SuperClassRanges; }
bool isTemplateArg(Init *Name) const {
- for (unsigned i = 0, e = TemplateArgs.size(); i != e; ++i)
- if (TemplateArgs[i] == Name) return true;
+ for (Init *TA : TemplateArgs)
+ if (TA == Name) return true;
return false;
}
bool isTemplateArg(StringRef Name) const {
}
const RecordVal *getValue(const Init *Name) const {
- for (unsigned i = 0, e = Values.size(); i != e; ++i)
- if (Values[i].getNameInit() == Name) return &Values[i];
+ for (const RecordVal &Val : Values)
+ if (Val.getNameInit() == Name) return &Val;
return nullptr;
}
const RecordVal *getValue(StringRef Name) const {
return getValue(StringInit::get(Name));
}
RecordVal *getValue(const Init *Name) {
- for (unsigned i = 0, e = Values.size(); i != e; ++i)
- if (Values[i].getNameInit() == Name) return &Values[i];
+ for (RecordVal &Val : Values)
+ if (Val.getNameInit() == Name) return &Val;
return nullptr;
}
RecordVal *getValue(StringRef Name) {
}
bool isSubClassOf(const Record *R) const {
- for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
- if (SuperClasses[i] == R)
+ for (const Record *SC : SuperClasses)
+ if (SC == R)
return true;
return false;
}
bool isSubClassOf(StringRef Name) const {
- for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
- if (SuperClasses[i]->getNameInitAsString() == Name)
+ for (const Record *SC : SuperClasses)
+ if (SC->getNameInitAsString() == Name)
return true;
return false;
}
bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) {
Record *SC = SubClass.Rec;
// Add all of the values in the subclass into the current class.
- const std::vector<RecordVal> &Vals = SC->getValues();
- for (unsigned i = 0, e = Vals.size(); i != e; ++i)
- if (AddValue(CurRec, SubClass.RefRange.Start, Vals[i]))
+ for (const RecordVal &Val : SC->getValues())
+ if (AddValue(CurRec, SubClass.RefRange.Start, Val))
return true;
const std::vector<Init *> &TArgs = SC->getTemplateArgs();
auto IterRec = make_unique<Record>(*CurRec);
// Set the iterator values now.
- for (unsigned i = 0, e = IterVals.size(); i != e; ++i) {
- VarInit *IterVar = IterVals[i].IterVar;
- TypedInit *IVal = dyn_cast<TypedInit>(IterVals[i].IterValue);
+ for (IterRecord &IR : IterVals) {
+ VarInit *IterVar = IR.IterVar;
+ TypedInit *IVal = dyn_cast<TypedInit>(IR.IterValue);
if (!IVal)
return Error(Loc, "foreach iterator value is untyped");
assert(!IterType && "Type already initialized?");
IterType = IntRecTy::get();
std::vector<Init*> Values;
- for (unsigned i = 0, e = Ranges.size(); i != e; ++i)
- Values.push_back(IntInit::get(Ranges[i]));
+ for (unsigned R : Ranges)
+ Values.push_back(IntInit::get(R));
ForeachListValue = ListInit::get(Values, IterType);
}
/// \brief Apply the current let bindings to \a CurRec.
/// \returns true on error, false otherwise.
bool TGParser::ApplyLetStack(Record *CurRec) {
- for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
- for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
- if (SetValue(CurRec, LetStack[i][j].Loc, LetStack[i][j].Name,
- LetStack[i][j].Bits, LetStack[i][j].Value))
+ for (std::vector<LetRecord> &LetInfo : LetStack)
+ for (LetRecord &LR : LetInfo)
+ if (SetValue(CurRec, LR.Loc, LR.Name, LR.Bits, LR.Value))
return true;
return false;
}