Skip to content

Commit 3c417d5

Browse files
committed
swift-ide-test: Allow objc-interop to be configured
This adds a -disable-objc-interop flag to allow objc-interop to be disabled, and an -enable-objc-interop flag to allow objc-interop to be enabled. Objc interop will default to enabled on darwin, and disabled on other platforms.
1 parent 3d1889c commit 3c417d5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,16 @@ static llvm::cl::opt<bool> DebugConstraintSolver("debug-constraints",
636636
static llvm::cl::opt<bool>
637637
IncludeLocals("include-locals", llvm::cl::desc("Index local symbols too."),
638638
llvm::cl::cat(Category), llvm::cl::init(false));
639+
640+
static llvm::cl::opt<bool>
641+
EnableObjCInterop("enable-objc-interop",
642+
llvm::cl::desc("Enable ObjC interop."),
643+
llvm::cl::cat(Category), llvm::cl::init(false));
644+
645+
static llvm::cl::opt<bool>
646+
DisableObjCInterop("disable-objc-interop",
647+
llvm::cl::desc("Disable ObjC interop."),
648+
llvm::cl::cat(Category), llvm::cl::init(false));
639649
} // namespace options
640650

641651
static std::unique_ptr<llvm::MemoryBuffer>
@@ -3005,6 +3015,14 @@ int main(int argc, char *argv[]) {
30053015
InitInvok.getLangOptions().EffectiveLanguageVersion = actual.getValue();
30063016
}
30073017
}
3018+
if (options::DisableObjCInterop) {
3019+
InitInvok.getLangOptions().EnableObjCInterop = false;
3020+
} else if (options::EnableObjCInterop) {
3021+
InitInvok.getLangOptions().EnableObjCInterop = true;
3022+
} else {
3023+
InitInvok.getLangOptions().EnableObjCInterop =
3024+
llvm::Triple(InitInvok.getTargetTriple()).isOSDarwin();
3025+
}
30083026
InitInvok.getClangImporterOptions().ModuleCachePath =
30093027
options::ModuleCachePath;
30103028
InitInvok.getClangImporterOptions().PrecompiledHeaderOutputDir =

0 commit comments

Comments
 (0)