Skip to content

Commit dc205b3

Browse files
committed
IRGen: Do not set dllexport on declarations.
Setting dllexport on a declaration has no effect, as we do not emit export directives for declarations. Part of the fix for PR32334. Differential Revision: https://reviews.llvm.org/D31162 llvm-svn: 298330
1 parent c12716e commit dc205b3

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@ static void setLinkageAndVisibilityForGV(llvm::GlobalValue *GV,
10361036
GV->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
10371037
} else if (ND->hasAttr<DLLExportAttr>()) {
10381038
GV->setLinkage(llvm::GlobalValue::ExternalLinkage);
1039-
GV->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass);
10401039
} else if (ND->hasAttr<WeakAttr>() || ND->isWeakImported()) {
10411040
// "extern_weak" is overloaded in LLVM; we probably should have
10421041
// separate linkage types for this.

clang/test/CodeGenCXX/dllexport.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ inline int __declspec(dllexport) inlineStaticLocalsFunc() {
108108
template<typename T> __declspec(dllexport) int VarTmplDef;
109109
INSTVAR(VarTmplDef<ExplicitInst_Exported>)
110110

111-
// MSC-DAG: @"\01??$VarTmplImplicitDef@UImplicitInst_Exported@@@@3HA" = external dllexport global
112-
// GNU-DAG: @_Z18VarTmplImplicitDefI21ImplicitInst_ExportedE = external dllexport global
111+
// MSC-DAG: @"\01??$VarTmplImplicitDef@UImplicitInst_Exported@@@@3HA" = external global
112+
// GNU-DAG: @_Z18VarTmplImplicitDefI21ImplicitInst_ExportedE = external global
113113
template<typename T> __declspec(dllexport) int VarTmplImplicitDef;
114114
USEVAR(VarTmplImplicitDef<ImplicitInst_Exported>)
115115

@@ -528,7 +528,7 @@ struct __declspec(dllexport) T {
528528
// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01?a@T@@QAEXXZ"
529529

530530
static int b;
531-
// M32-DAG: @"\01?b@T@@2HA" = external dllexport global i32
531+
// M32-DAG: @"\01?b@T@@2HA" = external global i32
532532

533533
static int c;
534534
// M32-DAG: @"\01?c@T@@2HA" = dllexport global i32 0, align 4

0 commit comments

Comments
 (0)