Skip to content

Commit 21605a1

Browse files
committed
[mlir] Mark ClassID::getID as LLVM_EXTERNAL_VISIBILITY to ensure only one version exists
Summary: ClassID is used as a type id and must be unique in the face of shared libraries to ensure correctness. This fixes failures related to BUILD_SHARED_LIBs on macos. Differential Revision: https://reviews.llvm.org/D77764
1 parent fe69eb1 commit 21605a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mlir/include/mlir/Support/STLExtras.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ inline void interleaveComma(const Container &c, raw_ostream &os) {
9393
/// Note: We specify an explicit alignment here to allow use with PointerIntPair
9494
/// and other utilities/data structures that require a known pointer alignment.
9595
struct alignas(8) ClassID {
96-
template <typename T> static ClassID *getID() {
96+
template <typename T>
97+
LLVM_EXTERNAL_VISIBILITY static ClassID *getID() {
9798
static ClassID id;
9899
return &id;
99100
}
100-
template <template <typename T> class Trait> static ClassID *getID() {
101+
template <template <typename T> class Trait>
102+
LLVM_EXTERNAL_VISIBILITY static ClassID *getID() {
101103
static ClassID id;
102104
return &id;
103105
}

0 commit comments

Comments
 (0)