OSDN Git Service

[PM] Make AnalysisManager::registerPass take its parameter by universal reference.
authorJustin Lebar <jlebar@google.com>
Sat, 3 Dec 2016 19:49:19 +0000 (19:49 +0000)
committerJustin Lebar <jlebar@google.com>
Sat, 3 Dec 2016 19:49:19 +0000 (19:49 +0000)
Summary:
Previously, we were forcing a copy if you passed an lvalue argument; now
we'll take it by reference.

Reviewers: chandlerc

Subscribers: mehdi_amini, silvas, llvm-commits

Differential Revision: https://reviews.llvm.org/D27370

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288594 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/PassManager.h

index a746ebb..9298486 100644 (file)
@@ -548,7 +548,8 @@ public:
   /// interface also lends itself to minimizing the number of times we have to
   /// do lookups for analyses or construct complex passes only to throw them
   /// away.
-  template <typename PassBuilderT> bool registerPass(PassBuilderT PassBuilder) {
+  template <typename PassBuilderT>
+  bool registerPass(PassBuilderT &&PassBuilder) {
     typedef decltype(PassBuilder()) PassT;
     typedef detail::AnalysisPassModel<IRUnitT, PassT, PreservedAnalyses,
                                       Invalidator, ExtraArgTs...>