This revision was automatically updated to reflect the committed changes. Closed by commit rC359343: [MinGW] Do dllexport inline methods in template instantiation (authored by mstorsjo, committed by ).
Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61176/new/ https://reviews.llvm.org/D61176 Files: lib/Sema/SemaDeclCXX.cpp test/CodeGenCXX/mingw-template-dllexport.cpp Index: test/CodeGenCXX/mingw-template-dllexport.cpp =================================================================== --- test/CodeGenCXX/mingw-template-dllexport.cpp +++ test/CodeGenCXX/mingw-template-dllexport.cpp @@ -7,11 +7,9 @@ template <class T> class c { - void f(); + void f() {} }; -template <class T> void c<T>::f() {} - template class __declspec(dllexport) c<int>; // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -5726,9 +5726,12 @@ continue; if (MD->isInlined()) { - // MinGW does not import or export inline methods. + // MinGW does not import or export inline methods. But do it for + // template instantiations. if (!Context.getTargetInfo().getCXXABI().isMicrosoft() && - !Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) + !Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() && + TSK != TSK_ExplicitInstantiationDeclaration && + TSK != TSK_ExplicitInstantiationDefinition) continue; // MSVC versions before 2015 don't export the move assignment operators
Index: test/CodeGenCXX/mingw-template-dllexport.cpp =================================================================== --- test/CodeGenCXX/mingw-template-dllexport.cpp +++ test/CodeGenCXX/mingw-template-dllexport.cpp @@ -7,11 +7,9 @@ template <class T> class c { - void f(); + void f() {} }; -template <class T> void c<T>::f() {} - template class __declspec(dllexport) c<int>; // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv Index: lib/Sema/SemaDeclCXX.cpp =================================================================== --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -5726,9 +5726,12 @@ continue; if (MD->isInlined()) { - // MinGW does not import or export inline methods. + // MinGW does not import or export inline methods. But do it for + // template instantiations. if (!Context.getTargetInfo().getCXXABI().isMicrosoft() && - !Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) + !Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() && + TSK != TSK_ExplicitInstantiationDeclaration && + TSK != TSK_ExplicitInstantiationDefinition) continue; // MSVC versions before 2015 don't export the move assignment operators
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits