Skip to content

Commit 3d1889c

Browse files
committed
ClangImporter: default to ios objc runtime on non-darwin platforms
This allows objc interop to be tested on non-darwin platforms. The iOS runtime is used because the abi is the same as the macOS abi, but without fragility concerns.
1 parent 4dba0a3 commit 3d1889c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,16 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
464464
SHIMS_INCLUDE_FLAG, searchPathOpts.RuntimeResourcePath,
465465
});
466466

467-
if (LangOpts.EnableObjCInterop)
467+
if (LangOpts.EnableObjCInterop) {
468468
invocationArgStrs.insert(invocationArgStrs.end(),
469469
{"-x", "objective-c", "-std=gnu11", "-fobjc-arc"});
470-
else
470+
// TODO: Investigate whether 7.0 is a suitable default version.
471+
if (!triple.isOSDarwin())
472+
invocationArgStrs.insert(invocationArgStrs.end(),
473+
{"-fobjc-runtime=ios-7.0"});
474+
} else {
471475
invocationArgStrs.insert(invocationArgStrs.end(), {"-x", "c", "-std=gnu11"});
476+
}
472477

473478
// Set C language options.
474479
if (triple.isOSDarwin()) {

0 commit comments

Comments
 (0)