From a28da41a4aa3d797f74009ab74bfffc3ba7e0194 Mon Sep 17 00:00:00 2001 From: Ahmed Bougacha Date: Thu, 26 Jan 2017 22:07:37 +0000 Subject: [PATCH] [GlobalISel] Remove duplicate function using variadic templates. NFC. I think the initial version of r293172 was trying: std::forward(args)... which doesn't compile. This seems like the correct way: std::forward(args)... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293214 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/GlobalISelEmitter.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/utils/TableGen/GlobalISelEmitter.cpp b/utils/TableGen/GlobalISelEmitter.cpp index 02ef6fa47c1..a9f4d7aae23 100644 --- a/utils/TableGen/GlobalISelEmitter.cpp +++ b/utils/TableGen/GlobalISelEmitter.cpp @@ -129,7 +129,8 @@ public: /// Construct a new operand predicate and add it to the matcher. template Kind &addPredicate(Args&&... args) { - Predicates.emplace_back(llvm::make_unique(std::forward(args)...)); + Predicates.emplace_back( + llvm::make_unique(std::forward(args)...)); return *static_cast(Predicates.back().get()); } @@ -140,8 +141,8 @@ public: } /// Emit a C++ expression that tests whether all the predicates are met. - template - void emitCxxPredicatesExpr(raw_ostream &OS, Arg1&& arg1) const { + template + void emitCxxPredicatesExpr(raw_ostream &OS, Args &&... args) const { if (Predicates.empty()) { OS << "true"; return; @@ -150,24 +151,7 @@ public: StringRef Separator = ""; for (const auto &Predicate : predicates()) { OS << Separator << "("; - Predicate->emitCxxPredicateExpr(OS, std::forward(arg1)); - OS << ")"; - Separator = " && "; - } - } - - template - void emitCxxPredicatesExpr(raw_ostream &OS, Arg1&& arg1, Arg2&& arg2) const { - if (Predicates.empty()) { - OS << "true"; - return; - } - - StringRef Separator = ""; - for (const auto &Predicate : predicates()) { - OS << Separator << "("; - Predicate->emitCxxPredicateExpr(OS, std::forward(arg1), - std::forward(arg2)); + Predicate->emitCxxPredicateExpr(OS, std::forward(args)...); OS << ")"; Separator = " && "; } -- 2.40.0