[PATCH] D145970: [MSVC][PS][dllexport/dllimport] Propagate a dllexport/dllimport attribute to template baseclasses

Wolfgang Pieb via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 11:09:28 PDT 2023


wolfgangp created this revision.
wolfgangp added reviewers: probinson, bd1976llvm, hans, mstorsjo.
Herald added a project: All.
wolfgangp requested review of this revision.

For the Playstation platform, mimic MSVC in propagating dllexport/dllimport attributes
to an instantiated template base class.

This is particularly relevant in cases where the base class has static members that need to be shared between all instantiations:

  template <class T>
  class Base
  {
  public:
    static unsigned int& foo()
    {
      static unsigned int S = 0xffffffff;
      return S;
    }
  };
  
  class __declspec(dllexport) A : public Base<A>
  {
  };

BTW, this is unrelated to D145271 <https://reviews.llvm.org/D145271>


https://reviews.llvm.org/D145970

Files:
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CodeGenCXX/dllexport.cpp
  clang/test/CodeGenCXX/dllimport.cpp
  clang/test/SemaCXX/dllexport.cpp
  clang/test/SemaCXX/dllimport.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145970.504753.patch
Type: text/x-patch
Size: 24650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230313/a57225be/attachment-0001.bin>


More information about the cfe-commits mailing list