From: Hans Wennborg Date: Thu, 21 Aug 2014 00:10:34 +0000 (+0000) Subject: test/CodeGenCXX/dllexport.cpp: don't instantiate templates in USEMEMFUNC macro X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d284ced36bc2ac81300b22e6154e1a789c0e4d35;p=clang test/CodeGenCXX/dllexport.cpp: don't instantiate templates in USEMEMFUNC macro Use the derived class in the macro instead, to make it unambigous where the template is being instantiated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216142 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index 5097abf0c0..846978dbb1 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -612,7 +612,7 @@ template struct __declspec(dllimport) ExplicitlyImportInstantiatedTemplate; // MS: ClassTemplate gets exported. struct __declspec(dllexport) DerivedFromTemplate : public ClassTemplate {}; -USEMEMFUNC(ClassTemplate, func) +USEMEMFUNC(DerivedFromTemplate, func) // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ClassTemplate@H@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN13ClassTemplateIiE4funcEv @@ -623,57 +623,57 @@ struct __declspec(dllexport) DerivedFromExportedTemplate : public ExportedClassT // ImportedClassTemplate is explicitly imported. struct __declspec(dllexport) DerivedFromImportedTemplate : public ImportedClassTemplate {}; -USEMEMFUNC(ImportedClassTemplate, func) +USEMEMFUNC(DerivedFromImportedTemplate, func) // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$ImportedClassTemplate@H@@QAEXXZ" // G32-DAG: declare dllimport x86_thiscallcc void @_ZN21ImportedClassTemplateIiE4funcEv // Base class already instantiated without dll attribute. struct DerivedFromTemplateD : public ClassTemplate {}; struct __declspec(dllexport) DerivedFromTemplateD2 : public ClassTemplate {}; -USEMEMFUNC(ClassTemplate, func) +USEMEMFUNC(DerivedFromTemplateD2, func) // M32-DAG: define linkonce_odr x86_thiscallcc void @"\01?func@?$ClassTemplate@N@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN13ClassTemplateIdE4funcEv // MS: Base class already instantiated with different dll attribute. struct __declspec(dllimport) DerivedFromTemplateB : public ClassTemplate {}; struct __declspec(dllexport) DerivedFromTemplateB2 : public ClassTemplate {}; -USEMEMFUNC(ClassTemplate, func) +USEMEMFUNC(DerivedFromTemplateB2, func) // M32-DAG: {{declare|define available_externally}} dllimport x86_thiscallcc void @"\01?func@?$ClassTemplate@_N@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN13ClassTemplateIbE4funcEv // Base class already specialized without dll attribute. struct __declspec(dllexport) DerivedFromExplicitlySpecializedTemplate : public ExplicitlySpecializedTemplate {}; -USEMEMFUNC(ExplicitlySpecializedTemplate, func) +USEMEMFUNC(DerivedFromExplicitlySpecializedTemplate, func) // M32-DAG: define linkonce_odr x86_thiscallcc void @"\01?func@?$ExplicitlySpecializedTemplate@H@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN29ExplicitlySpecializedTemplateIiE4funcEv // Base class alredy specialized with export attribute. struct __declspec(dllexport) DerivedFromExplicitlyExportSpecializedTemplate : public ExplicitlyExportSpecializedTemplate {}; -USEMEMFUNC(ExplicitlyExportSpecializedTemplate, func) +USEMEMFUNC(DerivedFromExplicitlyExportSpecializedTemplate, func) // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ExplicitlyExportSpecializedTemplate@H@@QAEXXZ" // G32-DAG: define weak_odr dllexport x86_thiscallcc void @_ZN35ExplicitlyExportSpecializedTemplateIiE4funcEv // Base class already specialized with import attribute. struct __declspec(dllexport) DerivedFromExplicitlyImportSpecializedTemplate : public ExplicitlyImportSpecializedTemplate {}; -USEMEMFUNC(ExplicitlyImportSpecializedTemplate, func) +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 // Base class already instantiated without dll attribute. struct __declspec(dllexport) DerivedFromExplicitlyInstantiatedTemplate : public ExplicitlyInstantiatedTemplate {}; -USEMEMFUNC(ExplicitlyInstantiatedTemplate, func) +USEMEMFUNC(DerivedFromExplicitlyInstantiatedTemplate, func) // M32-DAG: define weak_odr x86_thiscallcc void @"\01?func@?$ExplicitlyInstantiatedTemplate@H@@QAEXXZ" // G32-DAG: define weak_odr x86_thiscallcc void @_ZN30ExplicitlyInstantiatedTemplateIiE4funcEv // Base class already instantiated with export attribute. struct __declspec(dllexport) DerivedFromExplicitlyExportInstantiatedTemplate : public ExplicitlyExportInstantiatedTemplate {}; -USEMEMFUNC(ExplicitlyExportInstantiatedTemplate, func) +USEMEMFUNC(DerivedFromExplicitlyExportInstantiatedTemplate, func) // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$ExplicitlyExportInstantiatedTemplate@H@@QAEXXZ" // G32-DAG: define weak_odr dllexport x86_thiscallcc void @_ZN36ExplicitlyExportInstantiatedTemplateIiE4funcEv // Base class already instantiated with import attribute. struct __declspec(dllexport) DerivedFromExplicitlyImportInstantiatedTemplate : public ExplicitlyImportInstantiatedTemplate {}; -USEMEMFUNC(ExplicitlyImportInstantiatedTemplate, func) +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 @@ -681,6 +681,6 @@ USEMEMFUNC(ExplicitlyImportInstantiatedTemplate, func) template struct TopClass { void func() {} }; template struct MiddleClass : public TopClass { }; struct __declspec(dllexport) BottomClass : public MiddleClass { }; -USEMEMFUNC(TopClass, func) +USEMEMFUNC(BottomClass, func) // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?func@?$TopClass@H@@QAEXXZ" // G32-DAG: define linkonce_odr x86_thiscallcc void @_ZN8TopClassIiE4funcEv