diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-21 21:49:08 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-21 21:49:08 +0000 |
commit | 8072125f7b67f2a91ef3fa14b69805fbc5b7d89b (patch) | |
tree | c565239bf29ff810077feb7361af7585507485a0 /llvm/utils/TableGen/CodeGenSchedule.cpp | |
parent | 9515c52294c650755f8056a5ee77e32c08c97833 (diff) | |
download | bcm5719-llvm-8072125f7b67f2a91ef3fa14b69805fbc5b7d89b.tar.gz bcm5719-llvm-8072125f7b67f2a91ef3fa14b69805fbc5b7d89b.zip |
Use Regex objects by value (rather than 'new'ed) in CodeGenSchedule.
llvm-svn: 206800
Diffstat (limited to 'llvm/utils/TableGen/CodeGenSchedule.cpp')
-rw-r--r-- | llvm/utils/TableGen/CodeGenSchedule.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index 3a6db250eed..95d31862ad7 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -59,7 +59,7 @@ struct InstRegexOp : public SetTheory::Operator { 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::Operator { 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 |