Skip to content

[6.0] modulewrap: Disable ObjC interop by default on non-Darwin platforms #73778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/DriverTool/modulewrap_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ModuleWrapInvocation {
llvm::Triple TargetTriple;
std::vector<std::string> InputFilenames;
bool UseSharedResourceFolder = true;
bool EnableObjCInterop = true;

public:
bool hasSingleInput() const { return InputFilenames.size() == 1; }
Expand All @@ -65,6 +66,7 @@ class ModuleWrapInvocation {
llvm::Triple &getTargetTriple() { return TargetTriple; }

bool useSharedResourceFolder() { return UseSharedResourceFolder; }
bool enableObjCInterop() { return EnableObjCInterop; }

int parseArgs(llvm::ArrayRef<const char *> Args, DiagnosticEngine &Diags) {
using namespace options;
Expand Down Expand Up @@ -124,6 +126,9 @@ class ModuleWrapInvocation {
UseSharedResourceFolder = false;
}

EnableObjCInterop = ParsedArgs.hasFlag(OPT_enable_objc_interop,
OPT_disable_objc_interop, TargetTriple.isOSDarwin());

return 0;
}
};
Expand Down Expand Up @@ -184,6 +189,7 @@ int modulewrap_main(ArrayRef<const char *> Args, const char *Argv0,
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;
CASOptions CASOpts;
LangOpts.Target = Invocation.getTargetTriple();
LangOpts.EnableObjCInterop = Invocation.enableObjCInterop();
ASTContext &ASTCtx = *ASTContext::get(
LangOpts, TypeCheckOpts, SILOpts, SearchPathOpts, ClangImporterOpts,
SymbolGraphOpts, CASOpts, SrcMgr, Instance.getDiags(),
Expand Down