Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit a28da41

Browse files
committed
[GlobalISel] Remove duplicate function using variadic templates. NFC.
I think the initial version of r293172 was trying: std::forward<Args...>(args)... which doesn't compile. This seems like the correct way: std::forward<Args>(args)... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293214 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e264bcd commit a28da41

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

utils/TableGen/GlobalISelEmitter.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ template <class PredicateTy> class PredicateListMatcher {
129129
/// Construct a new operand predicate and add it to the matcher.
130130
template <class Kind, class... Args>
131131
Kind &addPredicate(Args&&... args) {
132-
Predicates.emplace_back(llvm::make_unique<Kind>(std::forward<Args...>(args)...));
132+
Predicates.emplace_back(
133+
llvm::make_unique<Kind>(std::forward<Args>(args)...));
133134
return *static_cast<Kind *>(Predicates.back().get());
134135
}
135136

@@ -140,8 +141,8 @@ template <class PredicateTy> class PredicateListMatcher {
140141
}
141142

142143
/// Emit a C++ expression that tests whether all the predicates are met.
143-
template <class Arg1>
144-
void emitCxxPredicatesExpr(raw_ostream &OS, Arg1&& arg1) const {
144+
template <class... Args>
145+
void emitCxxPredicatesExpr(raw_ostream &OS, Args &&... args) const {
145146
if (Predicates.empty()) {
146147
OS << "true";
147148
return;
@@ -150,24 +151,7 @@ template <class PredicateTy> class PredicateListMatcher {
150151
StringRef Separator = "";
151152
for (const auto &Predicate : predicates()) {
152153
OS << Separator << "(";
153-
Predicate->emitCxxPredicateExpr(OS, std::forward<Arg1>(arg1));
154-
OS << ")";
155-
Separator = " && ";
156-
}
157-
}
158-
159-
template <class Arg1, class Arg2>
160-
void emitCxxPredicatesExpr(raw_ostream &OS, Arg1&& arg1, Arg2&& arg2) const {
161-
if (Predicates.empty()) {
162-
OS << "true";
163-
return;
164-
}
165-
166-
StringRef Separator = "";
167-
for (const auto &Predicate : predicates()) {
168-
OS << Separator << "(";
169-
Predicate->emitCxxPredicateExpr(OS, std::forward<Arg1>(arg1),
170-
std::forward<Arg2>(arg2));
154+
Predicate->emitCxxPredicateExpr(OS, std::forward<Args>(args)...);
171155
OS << ")";
172156
Separator = " && ";
173157
}

0 commit comments

Comments
 (0)