]> granicus.if.org Git - llvm/commitdiff
[PM] Take more drastic measures to work around MSVC's failure on this
authorChandler Carruth <chandlerc@gmail.com>
Wed, 11 Jan 2017 09:20:24 +0000 (09:20 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 11 Jan 2017 09:20:24 +0000 (09:20 +0000)
code. If this doesn't work and I can't find someone to help who has MSVC
installed, I'll back everything out I guess. =[

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

unittests/Analysis/LoopPassManagerTest.cpp

index 6288dc993e4b81bcfd18bb365d4b9860a17233b0..169af03e9db76c5bea4a84776391991ace92be18 100644 (file)
@@ -75,6 +75,15 @@ public:
   }
 
 protected:
+  // FIXME: MSVC seems unable to handle a lambda argument to Invoke from within
+  // the template, so we use a boring static function.
+  static bool invalidateCallback(IRUnitT &IR, const PreservedAnalyses &PA,
+                                 typename AnalysisManagerT::Invalidator &Inv) {
+    auto PAC = PA.template getChecker<Analysis>();
+    return !PAC.preserved() &&
+           !PAC.template preservedSet<AllAnalysesOn<IRUnitT>>();
+  }
+
   /// Derived classes should call this in their constructor to set up default
   /// mock actions. (We can't do this in our constructor because this has to
   /// run after the DerivedT is constructed.)
@@ -82,14 +91,8 @@ protected:
     ON_CALL(static_cast<DerivedT &>(*this),
             run(_, _, testing::Matcher<ExtraArgTs>(_)...))
         .WillByDefault(Return(this->getResult()));
-    auto InvalidateLambda = [](IRUnitT &IR, const PreservedAnalyses &PA,
-                               typename AnalysisManagerT::Invalidator &Inv) {
-      auto PAC = PA.template getChecker<Analysis>();
-      return !PAC.preserved() &&
-             !PAC.template preservedSet<AllAnalysesOn<IRUnitT>>();
-    };
     ON_CALL(static_cast<DerivedT &>(*this), invalidate(_, _, _))
-        .WillByDefault(Invoke(InvalidateLambda));
+        .WillByDefault(Invoke(&invalidateCallback));
   }
 };