Skip to content

Commit 8e71509

Browse files
committed
[cxx-interop] Do not look into extern blocks in libc++'s std_private_random_binomial_distribution
rdar://139067788
1 parent a5b4975 commit 8e71509

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/ClangImporter/SwiftLookupTable.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,17 @@ void importer::addEntryToLookupTable(SwiftLookupTable &table,
20462046
addDeclsFromContext(nestedLinkageSpecDecl);
20472047
}
20482048
};
2049-
addDeclsFromContext(linkageSpecDecl);
2049+
2050+
// HACK: libc++ redeclares lgamma_r in one of its headers, and that
2051+
// declaration hijacks lgamma_r from math.h where it is originally
2052+
// defined. This causes deserialization issues when loading the Darwin
2053+
// overlay on Apple platforms, because Swift cannot find lgamma_r in
2054+
// module _math.
2055+
bool shouldSkip = canonicalMember->getOwningModule() &&
2056+
canonicalMember->getOwningModule()->Name ==
2057+
"std_private_random_binomial_distribution";
2058+
if (!shouldSkip)
2059+
addDeclsFromContext(linkageSpecDecl);
20502060
}
20512061
}
20522062
}

0 commit comments

Comments
 (0)