[TextAPI] Add missing attribute to remove/merge/extract operations (#116729)

This commit is contained in:
Cyndy Ishida
2024-11-19 08:01:05 -08:00
committed by GitHub
parent b3995aa338
commit 03506bc0a9
2 changed files with 8 additions and 1 deletions

View File

@@ -172,6 +172,7 @@ InterfaceFile::merge(const InterfaceFile *O) const {
IF->setTwoLevelNamespace(isTwoLevelNamespace());
IF->setApplicationExtensionSafe(isApplicationExtensionSafe());
IF->setOSLibNotForSharedCache(isOSLibNotForSharedCache());
for (const auto &It : umbrellas()) {
if (!It.second.empty())
@@ -238,6 +239,8 @@ InterfaceFile::remove(Architecture Arch) const {
return make_error<TextAPIError>(TextAPIErrorCode::NoSuchArchitecture);
}
// FIXME: Figure out how to keep these attributes in sync when new ones are
// added.
std::unique_ptr<InterfaceFile> IF(new InterfaceFile());
IF->setFileType(getFileType());
IF->setPath(getPath());
@@ -248,6 +251,7 @@ InterfaceFile::remove(Architecture Arch) const {
IF->setSwiftABIVersion(getSwiftABIVersion());
IF->setTwoLevelNamespace(isTwoLevelNamespace());
IF->setApplicationExtensionSafe(isApplicationExtensionSafe());
IF->setOSLibNotForSharedCache(isOSLibNotForSharedCache());
for (const auto &It : umbrellas())
if (It.first.Arch != Arch)
IF->addParentUmbrella(It.first, It.second);
@@ -316,6 +320,7 @@ InterfaceFile::extract(Architecture Arch) const {
IF->setSwiftABIVersion(getSwiftABIVersion());
IF->setTwoLevelNamespace(isTwoLevelNamespace());
IF->setApplicationExtensionSafe(isApplicationExtensionSafe());
IF->setOSLibNotForSharedCache(isOSLibNotForSharedCache());
for (const auto &It : umbrellas())
if (It.first.Arch == Arch)
IF->addParentUmbrella(It.first, It.second);

View File

@@ -2077,7 +2077,8 @@ TEST(TBDv5, RemoveIF) {
"x86_64-macos"
],
"attributes": [
"flat_namespace"
"flat_namespace",
"not_for_dyld_shared_cache"
]
}
],
@@ -2242,6 +2243,7 @@ TEST(TBDv5, RemoveIF) {
EXPECT_EQ(PackedVersion(1, 2, 0), RemovedFile->getCurrentVersion());
EXPECT_EQ(PackedVersion(1, 1, 0), RemovedFile->getCompatibilityVersion());
EXPECT_TRUE(RemovedFile->isApplicationExtensionSafe());
EXPECT_TRUE(RemovedFile->isOSLibNotForSharedCache());
EXPECT_FALSE(RemovedFile->isTwoLevelNamespace());
EXPECT_EQ(0U, RemovedFile->documents().size());