Skip to content

tools: disable ObjC for wasm in SILFunctionExtractor #31920

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
merged 2 commits into from
Aug 9, 2021
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
13 changes: 13 additions & 0 deletions tools/sil-func-extractor/SILFunctionExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ static llvm::cl::opt<bool> EnableOSSAModules(
"this is disabled we do not serialize in OSSA "
"form when optimizing."));

static llvm::cl::opt<llvm::cl::boolOrDefault> EnableObjCInterop(
"enable-objc-interop",
llvm::cl::desc("Whether the Objective-C interop should be enabled. "
"The value is `true` by default on Darwin platforms."));

// This function isn't referenced outside its translation unit, but it
// can't use the "static" keyword because its address is used for
// getMainExecutable (since some platforms don't support taking the
Expand Down Expand Up @@ -250,6 +255,14 @@ int main(int argc, char **argv) {
Invocation.getLangOptions().EnableAccessControl = false;
Invocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;

if (EnableObjCInterop == llvm::cl::BOU_UNSET) {
Invocation.getLangOptions().EnableObjCInterop =
Invocation.getLangOptions().Target.isOSDarwin();
} else {
Invocation.getLangOptions().EnableObjCInterop =
EnableObjCInterop == llvm::cl::BOU_TRUE;
}

SILOptions &Opts = Invocation.getSILOptions();
Opts.EmitVerboseSIL = EmitVerboseSIL;
Opts.EmitSortedSIL = EmitSortedSIL;
Expand Down