This is an archive of the discontinued LLVM Phabricator instance.

Add a new Simulator entry for the target triple environment
ClosedPublic

Authored by bob.wilson on Oct 20 2017, 1:48 PM.

Details

Summary

Apple's iOS, tvOS and watchOS simulator platforms have never been clearly distinguished in the target triples. Even though they are intended to behave similarly to the corresponding device platforms, they have separate SDKs and are really separate platforms from the compiler's perspective. Clang now defines a macro when building for one of these simulator platforms (r297866) but that relies on the very indirect mechanism of checking to see which option was used to specify the minimum deployment target. That is not so great. Swift would also like to distinguish these simulator platforms in a similar way, but unlike Clang, Swift does not use a separate option to specify the minimum deployment target -- it uses a -target option to specify the target triple directly, including the OS version number. Using a different target triple for the simulator platforms is a much more direct and obvious way to specify this. Putting the "simulator" in the environment component of the triple means the OS values can stay the same and existing code the looks at the OS field will not be affected.

Diff Detail

Event Timeline

bob.wilson created this revision.Oct 20 2017, 1:48 PM
echristo accepted this revision.Oct 20 2017, 2:21 PM

No objections here.

-eric

This revision is now accepted and ready to land.Oct 20 2017, 2:21 PM
bob.wilson closed this revision.Oct 23 2017, 2:53 PM

Thanks, Eric!
r316380