[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
This commit is contained in:
River Riddle 2020-04-08 16:51:26 -07:00
parent fe69eb1196
commit 21605a1207
1 changed files with 4 additions and 2 deletions

View File

@ -93,11 +93,13 @@ inline void interleaveComma(const Container &c, raw_ostream &os) {
/// Note: We specify an explicit alignment here to allow use with PointerIntPair
/// and other utilities/data structures that require a known pointer alignment.
struct alignas(8) ClassID {
template <typename T> static ClassID *getID() {
template <typename T>
LLVM_EXTERNAL_VISIBILITY static ClassID *getID() {
static ClassID id;
return &id;
}
template <template <typename T> class Trait> static ClassID *getID() {
template <template <typename T> class Trait>
LLVM_EXTERNAL_VISIBILITY static ClassID *getID() {
static ClassID id;
return &id;
}