Skip to content

Commit 35254af

Browse files
committed
[Analysis] Provide inlined AnalysisKey in AnalysisInfoMixin
1 parent 7b54976 commit 35254af

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

llvm/include/llvm/IR/PassManager.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,15 @@ struct AnalysisInfoMixin : PassInfoMixin<DerivedT> {
9595
/// This ID is a pointer type that is guaranteed to be 8-byte aligned and thus
9696
/// suitable for use in sets, maps, and other data structures that use the low
9797
/// bits of pointers.
98-
///
99-
/// Note that this requires the derived type provide a static \c AnalysisKey
100-
/// member called \c Key.
101-
///
102-
/// FIXME: The only reason the mixin type itself can't declare the Key value
103-
/// is that some compilers cannot correctly unique a templated static variable
104-
/// so it has the same addresses in each instantiation. The only currently
105-
/// known platform with this limitation is Windows DLL builds, specifically
106-
/// building each part of LLVM as a DLL. If we ever remove that build
107-
/// configuration, this mixin can provide the static key as well.
10898
static AnalysisKey *ID() {
10999
static_assert(std::is_base_of<AnalysisInfoMixin, DerivedT>::value,
110100
"Must pass the derived type as the template argument!");
111101
return &DerivedT::Key;
112102
}
103+
104+
private:
105+
/// Opaque, unique ID for this analysis type.
106+
static constexpr AnalysisKey Key = {};
113107
};
114108

115109
namespace detail {

0 commit comments

Comments
 (0)