Skip to content

Commit 2e8a41f

Browse files
committed
[TextAPI] Add missing attribute to remove/merge/extract operations (llvm#116729)
(cherry picked from commit 03506bc)
1 parent e22f113 commit 2e8a41f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

llvm/lib/TextAPI/InterfaceFile.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ InterfaceFile::merge(const InterfaceFile *O) const {
172172

173173
IF->setTwoLevelNamespace(isTwoLevelNamespace());
174174
IF->setApplicationExtensionSafe(isApplicationExtensionSafe());
175+
IF->setOSLibNotForSharedCache(isOSLibNotForSharedCache());
175176

176177
for (const auto &It : umbrellas()) {
177178
if (!It.second.empty())
@@ -238,6 +239,8 @@ InterfaceFile::remove(Architecture Arch) const {
238239
return make_error<TextAPIError>(TextAPIErrorCode::NoSuchArchitecture);
239240
}
240241

242+
// FIXME: Figure out how to keep these attributes in sync when new ones are
243+
// added.
241244
std::unique_ptr<InterfaceFile> IF(new InterfaceFile());
242245
IF->setFileType(getFileType());
243246
IF->setPath(getPath());
@@ -248,6 +251,7 @@ InterfaceFile::remove(Architecture Arch) const {
248251
IF->setSwiftABIVersion(getSwiftABIVersion());
249252
IF->setTwoLevelNamespace(isTwoLevelNamespace());
250253
IF->setApplicationExtensionSafe(isApplicationExtensionSafe());
254+
IF->setOSLibNotForSharedCache(isOSLibNotForSharedCache());
251255
for (const auto &It : umbrellas())
252256
if (It.first.Arch != Arch)
253257
IF->addParentUmbrella(It.first, It.second);
@@ -316,6 +320,7 @@ InterfaceFile::extract(Architecture Arch) const {
316320
IF->setSwiftABIVersion(getSwiftABIVersion());
317321
IF->setTwoLevelNamespace(isTwoLevelNamespace());
318322
IF->setApplicationExtensionSafe(isApplicationExtensionSafe());
323+
IF->setOSLibNotForSharedCache(isOSLibNotForSharedCache());
319324
for (const auto &It : umbrellas())
320325
if (It.first.Arch == Arch)
321326
IF->addParentUmbrella(It.first, It.second);

llvm/unittests/TextAPI/TextStubV5Tests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2077,7 +2077,8 @@ TEST(TBDv5, RemoveIF) {
20772077
"x86_64-macos"
20782078
],
20792079
"attributes": [
2080-
"flat_namespace"
2080+
"flat_namespace",
2081+
"not_for_dyld_shared_cache"
20812082
]
20822083
}
20832084
],
@@ -2242,6 +2243,7 @@ TEST(TBDv5, RemoveIF) {
22422243
EXPECT_EQ(PackedVersion(1, 2, 0), RemovedFile->getCurrentVersion());
22432244
EXPECT_EQ(PackedVersion(1, 1, 0), RemovedFile->getCompatibilityVersion());
22442245
EXPECT_TRUE(RemovedFile->isApplicationExtensionSafe());
2246+
EXPECT_TRUE(RemovedFile->isOSLibNotForSharedCache());
22452247
EXPECT_FALSE(RemovedFile->isTwoLevelNamespace());
22462248
EXPECT_EQ(0U, RemovedFile->documents().size());
22472249

0 commit comments

Comments
 (0)