diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-02-11 13:25:24 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-02-11 13:25:24 +0000 |
| commit | 3897d3b845ab73af1f4abd7fd8cc6e43925af1b4 (patch) | |
| tree | e11f1177f7adb0f4c18009faf801850cfcd667cb /include/llvm/IR/PassManager.h | |
| parent | 963c784e8cd41cd556d0f19e090268b2e574e9f0 (diff) | |
Notes
Diffstat (limited to 'include/llvm/IR/PassManager.h')
| -rw-r--r-- | include/llvm/IR/PassManager.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/llvm/IR/PassManager.h b/include/llvm/IR/PassManager.h index 2e95f67a14a9..b7811fdb7504 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; |
