Page MenuHomePhabricator

[driver] Set the 'simulator' environment for Darwin when -m<os>simulator-version-min is used
ClosedPublic

Authored by arphaman on Nov 30 2017, 2:57 PM.

Details

Summary

r316380 added support for the 'simulator' environment to LLVM's triple. Clang's driver should pass this to the compiler when -m<os>simulator-version-min option is specified so that the compiler can avoid using OS & arch specific checks.

Diff Detail

Repository
rC Clang

Event Timeline

arphaman created this revision.Nov 30 2017, 2:57 PM
bob.wilson requested changes to this revision.Nov 30 2017, 5:06 PM
bob.wilson added inline comments.
lib/Driver/ToolChains/Darwin.cpp
1446–1454

These checks should set the simulator target as well.

This revision now requires changes to proceed.Nov 30 2017, 5:06 PM
arphaman added inline comments.Nov 30 2017, 5:52 PM
lib/Driver/ToolChains/Darwin.cpp
1446–1454

This would break the __APPLE_EMBEDDED_SIMULATOR__ macro, as that has to be specified only when is used -m(iphone|tv|watch)simulator-version-min. Or should we still set __APPLE_EMBEDDED_SIMULATOR__ in the driver and allow -simulator even without -m(iphone|tv|watch)simulator-version-min?

bob.wilson added inline comments.Nov 30 2017, 9:14 PM
lib/Driver/ToolChains/Darwin.cpp
1446–1454

The intention is that using a target triple with "simulator" in the environment should replace the use of -m*simulator-version-min.

arphaman updated this revision to Diff 125214.Dec 1 2017, 1:30 PM
arphaman edited edge metadata.
arphaman marked an inline comment as done.

Add "-simulator" environment even when -m*simulator-version-min isn't used using the arch/OS heuristic.

bob.wilson accepted this revision.Dec 4 2017, 6:04 PM
bob.wilson added inline comments.
lib/Driver/ToolChains/Darwin.cpp
1446–1454

Alex pointed out to me that the subsequent call to setTarget takes care of setting the triple, so this is already doing what I wanted.

This revision is now accepted and ready to land.Dec 4 2017, 6:04 PM
This revision was automatically updated to reflect the committed changes.