diff --git a/tools/sil-func-extractor/SILFunctionExtractor.cpp b/tools/sil-func-extractor/SILFunctionExtractor.cpp index be96d55123a3a..57d6ffd5d4f5d 100644 --- a/tools/sil-func-extractor/SILFunctionExtractor.cpp +++ b/tools/sil-func-extractor/SILFunctionExtractor.cpp @@ -116,6 +116,11 @@ static llvm::cl::opt EnableOSSAModules( "this is disabled we do not serialize in OSSA " "form when optimizing.")); +static llvm::cl::opt 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 @@ -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;