This is an archive of the discontinued LLVM Phabricator instance.

[MinGW] Ignore -fvisibility/-fvisibility-inlines-hidden for dllexport
ClosedPublic

Authored by MaskRay on Sep 1 2022, 7:48 PM.

Details

Summary

Similar to 123ce97fac78bc4519afd5d2aba17c59c5717aad for dllimport: dllexport
expresses a non-hidden visibility intention. We can consider it explicit and
therefore it should override the global visibility setting (see AST/Decl.cpp
"NamedDecl Implementation").

Adding the exception to CodeGenModule::setGlobalVisibility is somewhat weird,
but allows us to add the code in one place instead of many in AST/Decl.cpp.

Diff Detail

Event Timeline

MaskRay created this revision.Sep 1 2022, 7:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2022, 7:48 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
MaskRay requested review of this revision.Sep 1 2022, 7:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2022, 7:48 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MaskRay retitled this revision from [MinGW] Skip -fvisibility/-fvisibility-inlines-hidden for dllexport to [MinGW] Ignore -fvisibility/-fvisibility-inlines-hidden for dllexport.Sep 1 2022, 7:48 PM
MaskRay updated this revision to Diff 457483.Sep 1 2022, 7:49 PM

improve test

mstorsjo accepted this revision.Sep 1 2022, 10:42 PM

This LGTM, but one question about the test. Thanks!

clang/test/CodeGenCXX/dllstorage-hidden.cpp
4

What parts of this test requires -fms-extensions?

This revision is now accepted and ready to land.Sep 1 2022, 10:42 PM
MaskRay updated this revision to Diff 457625.Sep 2 2022, 9:55 AM
MaskRay marked an inline comment as done.

rename test to dllstorage-visibility.cpp
use -fdeclspec instead of -fms-extensions

MaskRay edited the summary of this revision. (Show Details)Sep 2 2022, 9:57 AM
This revision was landed with ongoing or failed builds.Sep 2 2022, 9:59 AM
This revision was automatically updated to reflect the committed changes.
clang/test/CodeGenCXX/dllstorage-hidden.cpp