Currently we error out if multiple platforms can supports the architectures in a fat binary. For example, on Darwin, almost every architecture supported by the host platform is also supported by the remote-macosx platform. Currently, the only way to disambiguate between the two is to specify the desired architecture.
This patch changes the behavior to account for the selected and host platform. The new algorithm works a follows:
- Returns the selected platform if it matches any of the architectures.
- Returns the host platform if it matches any of the architectures.
- Returns the platform that matches all the architectures.
If none of the above apply, this function returns a default platform. The candidates output argument differentiates between either no platforms supporting the given architecture or multiple platforms supporting the given architecture.
I've added a bunch of unit tests to codify this new behavior.
rdar://90360204
Would you mind adding a doxygen comment for this? I'm asking because the semantics are not clear to me just from looking at the function signature.