When clang required to infer target os version from --target option and
the os version is not specified in targets, check the host triple. If the
host and target are both macOS, use host triple to infer target os
version.
rdar://problem/41651999
Differential D48849
[Driver][Darwin] Use Host Triple to infer target os version steven_wu on Jul 2 2018, 2:30 PM. Authored by
Details When clang required to infer target os version from --target option and rdar://problem/41651999
Diff Detail
Event TimelineComment Actions Unfortunately, I wasn't able to write a test for this because the host triple in the configuration can either be x86_64-apple-darwin* or x86_64-apple-macosx*, but the one used passed by driver is always macosx one. I can't reliably compare those two. Comment Actions Hmm, the driver should not call inferDeploymentTargetFromArch when -target is passed. Or am I missing something? Comment Actions Good call. This only handles the *-apple-darwin case. Maybe the same should happen to *-apple-macosx. Comment Actions Nit: Could you please try to extract the shared code into a function, e.g. Optional<std::string> overrideMacOSTripleDefaultVersion(const llvm::Triple &Triple, ... OSTy, ... TheDriver) { if (Triple.getOSMajorVersion()) return None; llvm::Triple SystemTriple(llvm::sys::getProcessTriple()); if (SystemTriple.isMacOSX()) return getOSVersion(OSTy, SystemTriple, TheDriver)); return None; } |