Skip to content

Commit 2a220e1

Browse files
committed
tools: disable ObjC for wasm in SILFunctionExtractor
1 parent 6c50414 commit 2a220e1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tools/sil-func-extractor/SILFunctionExtractor.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ static llvm::cl::opt<bool> EnableOSSAModules(
116116
"this is disabled we do not serialize in OSSA "
117117
"form when optimizing."));
118118

119+
static llvm::cl::opt<llvm::cl::boolOrDefault> EnableObjCInterop(
120+
"enable-objc-interop",
121+
llvm::cl::desc("Whether the Objective-C interop should be enabled. "
122+
"The value is `true` by default on Darwin platforms."));
123+
119124
// This function isn't referenced outside its translation unit, but it
120125
// can't use the "static" keyword because its address is used for
121126
// getMainExecutable (since some platforms don't support taking the
@@ -250,6 +255,15 @@ int main(int argc, char **argv) {
250255
Invocation.getLangOptions().EnableAccessControl = false;
251256
Invocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;
252257

258+
if (EnableObjCInterop == llvm::cl::BOU_UNSET) {
259+
Invocation.getLangOptions().EnableObjCInterop =
260+
Invocation.getLangOptions().Target.isOSDarwin();
261+
} else if (EnableObjCInterop == llvm::cl::BOU_TRUE) {
262+
Invocation.getLangOptions().EnableObjCInterop = true;
263+
} else {
264+
Invocation.getLangOptions().EnableObjCInterop = false;
265+
}
266+
253267
SILOptions &Opts = Invocation.getSILOptions();
254268
Opts.EmitVerboseSIL = EmitVerboseSIL;
255269
Opts.EmitSortedSIL = EmitSortedSIL;

0 commit comments

Comments
 (0)