[PATCH] D101972: Force visibility of llvm::Any to external

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 11:14:55 PDT 2021


rnk added a comment.

Yes, we should land this and fix the issue. Sorry for the delay, I think I started to write something and got distracted.

I'm a bit concerned that we don't seem to understand the fundamental issue. From reading the code, it seems clear that the `Id` static data member should have default visibility. It's not clear why anything else needs default visibility, and that is unsettling.



================
Comment at: llvm/include/llvm/ADT/Any.h:26
 
-class Any {
+class LLVM_EXTERNAL_VISIBILITY Any {
   template <typename T> struct TypeId { static const char Id; };
----------------
tstellar wrote:
> Can you add a comment explaining why we need this here?
Please do add a comment here. I'd suggest:
  The `Typeid<T>::Id` static data member below is a globally unique identifier for the type `T`. It is explicitly marked with default visibility so that when `-fvisibility=hidden` is used, the loader still merges duplicate definitions across DSO boundaries.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101972/new/

https://reviews.llvm.org/D101972



More information about the llvm-commits mailing list