summaryrefslogtreecommitdiff
path: root/include/llvm/IR/PassManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/PassManager.h')
-rw-r--r--include/llvm/IR/PassManager.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/IR/PassManager.h b/include/llvm/IR/PassManager.h
index 2e95f67a14a94..b7811fdb75042 100644
--- a/include/llvm/IR/PassManager.h
+++ b/include/llvm/IR/PassManager.h
@@ -311,6 +311,8 @@ template <typename IRUnitT, typename... ExtraArgTs> class AnalysisManager;
template <typename DerivedT> struct PassInfoMixin {
/// Gets the name of the pass we are mixed into.
static StringRef name() {
+ static_assert(std::is_base_of<PassInfoMixin, DerivedT>::value,
+ "Must pass the derived type as the template argument!");
StringRef Name = getTypeName<DerivedT>();
if (Name.startswith("llvm::"))
Name = Name.drop_front(strlen("llvm::"));
@@ -339,7 +341,11 @@ struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
/// known platform with this limitation is Windows DLL builds, specifically
/// building each part of LLVM as a DLL. If we ever remove that build
/// configuration, this mixin can provide the static key as well.
- static AnalysisKey *ID() { return &DerivedT::Key; }
+ static AnalysisKey *ID() {
+ static_assert(std::is_base_of<AnalysisInfoMixin, DerivedT>::value,
+ "Must pass the derived type as the template argument!");
+ return &DerivedT::Key;
+ }
};
/// This templated class represents "all analyses that operate over \<a
@@ -1010,7 +1016,7 @@ extern template class InnerAnalysisManagerProxy<FunctionAnalysisManager,
template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
class OuterAnalysisManagerProxy
: public AnalysisInfoMixin<
- OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>> {
+ OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>> {
public:
/// \brief Result proxy object for \c OuterAnalysisManagerProxy.
class Result {
@@ -1072,7 +1078,7 @@ public:
private:
friend AnalysisInfoMixin<
- OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT>>;
+ OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>>;
static AnalysisKey Key;
const AnalysisManagerT *AM;