[llvm] r291661 - [PM] Take more drastic measures to work around MSVC's failure on this

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 01:20:25 PST 2017


Author: chandlerc
Date: Wed Jan 11 03:20:24 2017
New Revision: 291661

URL: http://llvm.org/viewvc/llvm-project?rev=291661&view=rev
Log:
[PM] Take more drastic measures to work around MSVC's failure on this
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. =[

Modified:
    llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp

Modified: llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp?rev=291661&r1=291660&r2=291661&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/LoopPassManagerTest.cpp Wed Jan 11 03:20:24 2017
@@ -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));
   }
 };
 




More information about the llvm-commits mailing list