]> granicus.if.org Git - clang/commit
MS ABI: Propagate class-level DLL attributes to class template specialization bases...
authorHans Wennborg <hans@hanshq.net>
Wed, 25 Jun 2014 18:25:57 +0000 (18:25 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 25 Jun 2014 18:25:57 +0000 (18:25 +0000)
commite5fdb78baffc29df6c772dbe80c113bc22bd72c6
tree58027e501f90d4c522627694a29d701b6e5e0b64
parentccaf37e1c9c5e4bf74224ef779d62b3ba05e3615
MS ABI: Propagate class-level DLL attributes to class template specialization bases (PR11170)

Consider the following code:

  template <typename T> class Base {};
  class __declspec(dllexport) class Derived : public Base<int> {}

When the base of an exported or imported class is a class template
specialization, MSVC will propagate the dll attribute to the base.
In the example code, Base<int> becomes a dllexported class.

This commit makes Clang do the proopagation when the base hasn't been
instantiated yet, and warns about it being unsupported otherwise.
This is different from MSVC, which allows changing a specialization
back and forth between dllimport and dllexport and seems to let the
last one win. Changing the dll attribute after instantiation would be
hard for us, and doesn't seem to come up in practice, so I think this
is a reasonable limitation to have.

MinGW doesn't do this kind of propagation.

Differential Revision: http://reviews.llvm.org/D4264

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211725 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDeclCXX.cpp
test/CodeGenCXX/dllexport.cpp
test/CodeGenCXX/dllimport.cpp
test/SemaCXX/dllexport.cpp
test/SemaCXX/dllimport.cpp