Skip to content

Commit 89b31cf

Browse files
authored
Merge pull request #84872 from hnrklssn/disable-safe-wrappers-in-stdlib
[Swiftify] Always skip safe wrappers when building the stdlib
2 parents daa415a + a8fec6f commit 89b31cf

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,10 @@ namespace swift {
11481148
/// ones to apply.
11491149
bool LoadVersionIndependentAPINotes = false;
11501150

1151+
/// Whether the importer should skip SafeInteropWrappers, even though the
1152+
/// feature is enabled.
1153+
bool DisableSafeInteropWrappers = false;
1154+
11511155
/// Return a hash code of any components from these options that should
11521156
/// contribute to a Swift Bridging PCH hash.
11531157
llvm::hash_code getPCHHashComponents() const {

lib/ClangImporter/ImportDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9535,7 +9535,8 @@ static StringRef getAttributeName(const clang::CountAttributedType *CAT) {
95359535
}
95369536

95379537
void ClangImporter::Implementation::swiftify(AbstractFunctionDecl *MappedDecl) {
9538-
if (!SwiftContext.LangOpts.hasFeature(Feature::SafeInteropWrappers))
9538+
if (!SwiftContext.LangOpts.hasFeature(Feature::SafeInteropWrappers) ||
9539+
SwiftContext.ClangImporterOpts.DisableSafeInteropWrappers)
95399540
return;
95409541
auto ClangDecl =
95419542
dyn_cast_or_null<clang::FunctionDecl>(MappedDecl->getClangDecl());

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,6 +2175,8 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts, ArgList &Args,
21752175

21762176
Opts.LoadVersionIndependentAPINotes |= Args.hasArg(OPT_version_independent_apinotes);
21772177

2178+
Opts.DisableSafeInteropWrappers |= FrontendOpts.ParseStdlib;
2179+
21782180
if (FrontendOpts.DisableImplicitModules)
21792181
Opts.DisableImplicitClangModules = true;
21802182

0 commit comments

Comments
 (0)