From 2a220e18dfcbd7c46169f273317b0c7fafa7fc57 Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Wed, 20 May 2020 18:47:36 +0100 Subject: [PATCH 1/2] tools: disable ObjC for wasm in SILFunctionExtractor --- tools/sil-func-extractor/SILFunctionExtractor.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/sil-func-extractor/SILFunctionExtractor.cpp b/tools/sil-func-extractor/SILFunctionExtractor.cpp index be96d55123a3a..b2ce89f5dcd23 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,15 @@ 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 if (EnableObjCInterop == llvm::cl::BOU_TRUE) { + Invocation.getLangOptions().EnableObjCInterop = true; + } else { + Invocation.getLangOptions().EnableObjCInterop = false; + } + SILOptions &Opts = Invocation.getSILOptions(); Opts.EmitVerboseSIL = EmitVerboseSIL; Opts.EmitSortedSIL = EmitSortedSIL; From 3cba7885c986c4788e9ec936482f243039f7b05a Mon Sep 17 00:00:00 2001 From: Max Desiatov Date: Mon, 9 Aug 2021 00:09:53 +0100 Subject: [PATCH 2/2] Update tools/sil-func-extractor/SILFunctionExtractor.cpp Co-authored-by: Saleem Abdulrasool --- tools/sil-func-extractor/SILFunctionExtractor.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/sil-func-extractor/SILFunctionExtractor.cpp b/tools/sil-func-extractor/SILFunctionExtractor.cpp index b2ce89f5dcd23..57d6ffd5d4f5d 100644 --- a/tools/sil-func-extractor/SILFunctionExtractor.cpp +++ b/tools/sil-func-extractor/SILFunctionExtractor.cpp @@ -258,10 +258,9 @@ int main(int argc, char **argv) { if (EnableObjCInterop == llvm::cl::BOU_UNSET) { Invocation.getLangOptions().EnableObjCInterop = Invocation.getLangOptions().Target.isOSDarwin(); - } else if (EnableObjCInterop == llvm::cl::BOU_TRUE) { - Invocation.getLangOptions().EnableObjCInterop = true; } else { - Invocation.getLangOptions().EnableObjCInterop = false; + Invocation.getLangOptions().EnableObjCInterop = + EnableObjCInterop == llvm::cl::BOU_TRUE; } SILOptions &Opts = Invocation.getSILOptions();