llvm.org GIT mirror llvm / 2b77be2
Use Regex objects by value (rather than 'new'ed) in CodeGenSchedule. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206800 91177308-0d34-0410-b5e6-96231b3b80d8 David Blaikie 6 years ago
1 changed file(s) with 4 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
5858
5959 void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts,
6060 ArrayRef Loc) override {
61 SmallVector*, 4> RegexList;
61 SmallVector, 4> RegexList;
6262 for (DagInit::const_arg_iterator
6363 AI = Expr->arg_begin(), AE = Expr->arg_end(); AI != AE; ++AI) {
6464 StringInit *SI = dyn_cast(*AI);
7171 pat.insert(0, "^(");
7272 pat.insert(pat.end(), ')');
7373 }
74 RegexList.push_back(new Regex(pat));
74 RegexList.push_back(Regex(pat));
7575 }
7676 for (CodeGenTarget::inst_iterator I = Target.inst_begin(),
7777 E = Target.inst_end(); I != E; ++I) {
78 for (SmallVectorImpl::iterator
79 RI = RegexList.begin(), RE = RegexList.end(); RI != RE; ++RI) {
80 if ((*RI)->match((*I)->TheDef->getName()))
78 for (auto &R : RegexList) {
79 if (R.match((*I)->TheDef->getName()))
8180 Elts.insert((*I)->TheDef);
8281 }
8382 }
84 DeleteContainerPointers(RegexList);
8583 }
8684 };
8785 } // end anonymous namespace