summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2016-08-19 09:26:00 +0000
committerChandler Carruth <chandlerc@gmail.com>2016-08-19 09:26:00 +0000
commit6b6375b1d094a1f3ea9f788952f70217bffda446 (patch)
treef6d841ee5ca76229520ee8fd2b615162a606e21d /llvm
parent7ee640f9b67e3269f19bbe166bbba6a93c0ee148 (diff)
downloadbcm5719-llvm-6b6375b1d094a1f3ea9f788952f70217bffda446.tar.gz
bcm5719-llvm-6b6375b1d094a1f3ea9f788952f70217bffda446.zip
[PM] Try to work-around what appears to be an MSVC SFINAE issue with
r279217 where it fails to select the path that other compilers select. The workaround won't be as careful to produce an error when an analysis result is incorrect, but we can rely on non-MSVC builds to catch such errors it seems and MSVC doesn't seem to support the alternative techniques. Hoping this brings the windows bots back to life. If not, will have to revert all of this. llvm-svn: 279225
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/IR/PassManagerInternal.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/include/llvm/IR/PassManagerInternal.h b/llvm/include/llvm/IR/PassManagerInternal.h
index a498d399336..2ffd55225fb 100644
--- a/llvm/include/llvm/IR/PassManagerInternal.h
+++ b/llvm/include/llvm/IR/PassManagerInternal.h
@@ -99,6 +99,15 @@ template <typename IRUnitT, typename ResultT> class ResultHasInvalidateMethod {
char a, b;
};
+ // Purely to help out MSVC which fails to disable the below specialization,
+ // explicitly enable using the result type's invalidate routine if we can
+ // successfully call that routine.
+ template <typename T> struct Nonce { typedef EnabledType Type; };
+ template <typename T>
+ static typename Nonce<decltype(std::declval<T>().invalidate(
+ std::declval<IRUnitT &>(), std::declval<PreservedAnalyses>()))>::Type
+ check(rank<2>);
+
// First we define an overload that can only be taken if there is no
// invalidate member. We do this by taking the address of an invalidate
// member in an adjacent base class of a derived class. This would be
@@ -115,7 +124,7 @@ template <typename IRUnitT, typename ResultT> class ResultHasInvalidateMethod {
static EnabledType check(rank<0>);
public:
- enum { Value = sizeof(check<ResultT>(rank<1>())) == sizeof(EnabledType) };
+ enum { Value = sizeof(check<ResultT>(rank<2>())) == sizeof(EnabledType) };
};
/// \brief Wrapper to model the analysis result concept.
OpenPOWER on IntegriCloud