summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-09-07 16:06:19 -0700
committerFangrui Song <i@maskray.me>2022-09-07 16:06:19 -0700
commitbc502d9c24f8fce3b90e3fe8a8a9ca18894e68cb (patch)
treeee806f7f9f1329403ff4d96323498a57e181d181 /clang/lib/CodeGen/CodeGenModule.cpp
parenteaf0986b1846441054f8b1725903a128a25c1c43 (diff)
Revert D133266 "[MinGW] Reject explicit non-default visibility applied to dllexport/dllimport declaration"
This reverts commit 91d8324366f405e871aa8174ab61fc66912964dd. The combo dllexport protected makes sense and is used by PlayStation. Will change the patch to allow dllexport protected.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 64a9e9d6f4c4..f9087cdd5d4d 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1099,6 +1099,8 @@ llvm::ConstantInt *CodeGenModule::getSize(CharUnits size) {
void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
const NamedDecl *D) const {
+ if (GV->hasDLLExportStorageClass() || GV->hasDLLImportStorageClass())
+ return;
// Internal definitions always have default visibility.
if (GV->hasLocalLinkage()) {
GV->setVisibility(llvm::GlobalValue::DefaultVisibility);
@@ -1109,14 +1111,6 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
// Set visibility for definitions, and for declarations if requested globally
// or set explicitly.
LinkageInfo LV = D->getLinkageAndVisibility();
- if (GV->hasDLLExportStorageClass() || GV->hasDLLImportStorageClass()) {
- // Reject explicit non-default visibility on dllexport/dllimport.
- if (LV.isVisibilityExplicit() && LV.getVisibility() != DefaultVisibility)
- getDiags().Report(D->getLocation(),
- diag::err_non_default_visibility_dllstorage)
- << (GV->hasDLLExportStorageClass() ? "dllexport" : "dllimport");
- return;
- }
if (LV.isVisibilityExplicit() || getLangOpts().SetVisibilityForExternDecls ||
!GV->isDeclarationForLinker())
GV->setVisibility(GetLLVMVisibility(LV.getVisibility()));