[PATCH] D77764: [mlir] Mark ClassID::getID as LLVM_EXTERNAL_VISIBILITY to ensure only one version exists

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 16:52:08 PDT 2020


rriddle created this revision.
rriddle added reviewers: mehdi_amini, jroelofs.
Herald added subscribers: llvm-commits, frgossen, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar.
Herald added a project: LLVM.
mehdi_amini accepted this revision.
This revision is now accepted and ready to land.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77764

Files:
  mlir/include/mlir/Support/STLExtras.h


Index: mlir/include/mlir/Support/STLExtras.h
===================================================================
--- mlir/include/mlir/Support/STLExtras.h
+++ mlir/include/mlir/Support/STLExtras.h
@@ -93,11 +93,13 @@
 /// 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;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77764.256144.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200408/be46e66a/attachment.bin>


More information about the llvm-commits mailing list