diff options
| author | Hans Wennborg <hans@hanshq.net> | 2014-11-03 14:24:45 +0000 |
|---|---|---|
| committer | Hans Wennborg <hans@hanshq.net> | 2014-11-03 14:24:45 +0000 |
| commit | 606bd6dcc547cf2f9fd7387321db79419bf60041 (patch) | |
| tree | 2acc1255fba6da316a5ec54f4a502cd7ec669fab /clang/test/CodeGenCXX/dllexport.cpp | |
| parent | 42bce8f69db28b6b39453ecfbf8da6fc45fb14bf (diff) | |
| download | bcm5719-llvm-606bd6dcc547cf2f9fd7387321db79419bf60041.tar.gz bcm5719-llvm-606bd6dcc547cf2f9fd7387321db79419bf60041.zip | |
Don't dllimport inline functions when targeting MinGW (PR21366)
It turns out that MinGW never dllimports of exports inline functions.
This means that code compiled with Clang would fail to link with
MinGW-compiled libraries since we might try to import functions that
are not imported.
To fix this, make Clang never dllimport inline functions when targeting
MinGW.
llvm-svn: 221154
Diffstat (limited to 'clang/test/CodeGenCXX/dllexport.cpp')
| -rw-r--r-- | clang/test/CodeGenCXX/dllexport.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/clang/test/CodeGenCXX/dllexport.cpp b/clang/test/CodeGenCXX/dllexport.cpp index 5eb2dbfa7f7..0878dff0b38 100644 --- a/clang/test/CodeGenCXX/dllexport.cpp +++ b/clang/test/CodeGenCXX/dllexport.cpp @@ -594,7 +594,8 @@ USEMEMFUNC(PartiallySpecializedExportedClassTemplate<void*>, f); // MS ignores DLL attributes on partial specializations; inheritance still works though. template <typename T> struct __declspec(dllexport) PartiallySpecializedExportedClassTemplate2 {}; -template <typename T> struct __declspec(dllimport) PartiallySpecializedExportedClassTemplate2<T*> { void f() {} }; +template <typename T> struct __declspec(dllimport) PartiallySpecializedExportedClassTemplate2<T*> { void f(); }; +template <typename T> void PartiallySpecializedExportedClassTemplate2<T*>::f() {} USEMEMFUNC(PartiallySpecializedExportedClassTemplate2<void*>, f); // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?f@?$PartiallySpecializedExportedClassTemplate2@PAX@@QAEXXZ" // G32-DAG: declare dllimport x86_thiscallcc void @_ZN42PartiallySpecializedExportedClassTemplate2IPvE1fEv @@ -621,20 +622,21 @@ struct __declspec(dllexport) ExportedDerivedClass : NonExportedBaseClass {}; template <typename T> struct ClassTemplate { void func() {} }; template <typename T> struct __declspec(dllexport) ExportedClassTemplate { void func() {} }; -template <typename T> struct __declspec(dllimport) ImportedClassTemplate { void func() {} }; +template <typename T> struct __declspec(dllimport) ImportedClassTemplate { void func(); }; +template <typename T> void ImportedClassTemplate<T>::func() {} template <typename T> struct ExplicitlySpecializedTemplate { void func() {} }; template <> struct ExplicitlySpecializedTemplate<int> { void func() {} }; template <typename T> struct ExplicitlyExportSpecializedTemplate { void func() {} }; template <> struct __declspec(dllexport) ExplicitlyExportSpecializedTemplate<int> { void func() {} }; -template <typename T> struct ExplicitlyImportSpecializedTemplate { void func() {} }; -template <> struct __declspec(dllimport) ExplicitlyImportSpecializedTemplate<int> { void func() {} }; +template <typename T> struct ExplicitlyImportSpecializedTemplate { void func(); }; +template <> struct __declspec(dllimport) ExplicitlyImportSpecializedTemplate<int> { void func(); }; template <typename T> struct ExplicitlyInstantiatedTemplate { void func() {} }; template struct ExplicitlyInstantiatedTemplate<int>; template <typename T> struct ExplicitlyExportInstantiatedTemplate { void func() {} }; template struct __declspec(dllexport) ExplicitlyExportInstantiatedTemplate<int>; -template <typename T> struct ExplicitlyImportInstantiatedTemplate { void func() {} }; +template <typename T> struct ExplicitlyImportInstantiatedTemplate { void func(); }; template struct __declspec(dllimport) ExplicitlyImportInstantiatedTemplate<int>; @@ -685,8 +687,8 @@ USEMEMFUNC(DerivedFromExplicitlyExportSpecializedTemplate, func) // Base class already specialized with import attribute. struct __declspec(dllexport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate<int> {}; USEMEMFUNC(DerivedFromExplicitlyImportSpecializedTemplate, func) -// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportSpecializedTemplate@H@@QAEXXZ" -// G32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv +// M32-DAG: declare dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportSpecializedTemplate@H@@QAEXXZ" +// G32-DAG: declare dllimport x86_thiscallcc void @_ZN35ExplicitlyImportSpecializedTemplateIiE4funcEv // Base class already instantiated without dll attribute. struct __declspec(dllexport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate<int> {}; @@ -703,8 +705,8 @@ USEMEMFUNC(DerivedFromExplicitlyExportInstantiatedTemplate, func) // Base class already instantiated with import attribute. struct __declspec(dllexport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate<int> {}; USEMEMFUNC(DerivedFromExplicitlyImportInstantiatedTemplate, func) -// M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportInstantiatedTemplate@H@@QAEXXZ" -// G32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv +// M32-DAG: declare dllimport x86_thiscallcc void @"\01?func@?$ExplicitlyImportInstantiatedTemplate@H@@QAEXXZ" +// G32-DAG: declare dllimport x86_thiscallcc void @_ZN36ExplicitlyImportInstantiatedTemplateIiE4funcEv // MS: A dll attribute propagates through multiple levels of instantiation. template <typename T> struct TopClass { void func() {} }; |

