[llvm] r206800 - Use Regex objects by value (rather than 'new'ed) in CodeGenSchedule.
David Blaikie
dblaikie at gmail.com
Mon Apr 21 14:49:08 PDT 2014
Author: dblaikie
Date: Mon Apr 21 16:49:08 2014
New Revision: 206800
URL: http://llvm.org/viewvc/llvm-project?rev=206800&view=rev
Log:
Use Regex objects by value (rather than 'new'ed) in CodeGenSchedule.
Modified:
llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenSchedule.cpp?rev=206800&r1=206799&r2=206800&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenSchedule.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenSchedule.cpp Mon Apr 21 16:49:08 2014
@@ -59,7 +59,7 @@ struct InstRegexOp : public SetTheory::O
void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
ArrayRef<SMLoc> Loc) override {
- SmallVector<Regex*, 4> RegexList;
+ SmallVector<Regex, 4> RegexList;
for (DagInit::const_arg_iterator
AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
StringInit *SI = dyn_cast<StringInit>(*AI);
@@ -72,17 +72,15 @@ struct InstRegexOp : public SetTheory::O
pat.insert(0, "^(");
pat.insert(pat.end(), ')');
}
- RegexList.push_back(new Regex(pat));
+ RegexList.push_back(Regex(pat));
}
for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
E = Target.inst_end(); I != E; ++I) {
- for (SmallVectorImpl<Regex*>::iterator
- RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
- if ((*RI)->match((*I)->TheDef->getName()))
+ for (auto &R : RegexList) {
+ if (R.match((*I)->TheDef->getName()))
Elts.insert((*I)->TheDef);
}
}
- DeleteContainerPointers(RegexList);
}
};
} // end anonymous namespace
More information about the llvm-commits
mailing list