[PATCH] D129700: [clang] Don't emit type tests for dllexport/import classes
Arthur Eubanks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 27 17:34:37 PST 2023
aeubanks updated this revision to Diff 500987.
aeubanks added a comment.
move HasHiddenLTOVisibility DLL code to AlwaysHasLTOVisibilityPublic
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129700/new/
https://reviews.llvm.org/D129700
Files:
clang/lib/CodeGen/CGVTables.cpp
clang/test/CodeGenCXX/lto-visibility-inference.cpp
Index: clang/test/CodeGenCXX/lto-visibility-inference.cpp
===================================================================
--- clang/test/CodeGenCXX/lto-visibility-inference.cpp
+++ clang/test/CodeGenCXX/lto-visibility-inference.cpp
@@ -74,10 +74,10 @@
// MS: type.test{{.*}}!"?AUC2@@"
c2->f();
// ITANIUM: type.test{{.*}}!"_ZTS2C3"
- // MS: type.test{{.*}}!"?AUC3@@"
+ // MS-NOT: type.test{{.*}}!"?AUC3@@"
c3->f();
// ITANIUM: type.test{{.*}}!"_ZTS2C4"
- // MS: type.test{{.*}}!"?AUC4@@"
+ // MS-NOT: type.test{{.*}}!"?AUC4@@"
c4->f();
// ITANIUM-NOT: type.test{{.*}}!"_ZTS2C5"
// MS-NOT: type.test{{.*}}!"?AUC5@@"
Index: clang/lib/CodeGen/CGVTables.cpp
===================================================================
--- clang/lib/CodeGen/CGVTables.cpp
+++ clang/lib/CodeGen/CGVTables.cpp
@@ -1211,7 +1211,8 @@
}
bool CodeGenModule::AlwaysHasLTOVisibilityPublic(const CXXRecordDecl *RD) {
- if (RD->hasAttr<LTOVisibilityPublicAttr>() || RD->hasAttr<UuidAttr>())
+ if (RD->hasAttr<LTOVisibilityPublicAttr>() || RD->hasAttr<UuidAttr>() ||
+ RD->hasAttr<DLLExportAttr>() || RD->hasAttr<DLLImportAttr>())
return true;
if (!getCodeGenOpts().LTOVisibilityPublicStd)
@@ -1238,13 +1239,9 @@
if (!isExternallyVisible(LV.getLinkage()))
return true;
- if (getTriple().isOSBinFormatCOFF()) {
- if (RD->hasAttr<DLLExportAttr>() || RD->hasAttr<DLLImportAttr>())
- return false;
- } else {
- if (LV.getVisibility() != HiddenVisibility)
- return false;
- }
+ if (!getTriple().isOSBinFormatCOFF() &&
+ LV.getVisibility() != HiddenVisibility)
+ return false;
return !AlwaysHasLTOVisibilityPublic(RD);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129700.500987.patch
Type: text/x-patch
Size: 1687 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230228/78e6a677/attachment.bin>
More information about the cfe-commits
mailing list