Right now, sys::getProcessTriple returns the LLVM_HOST_TRIPLE, whose system version might not be the actual version of the system on which the compiler running. This patch ensures that for macOS, sys::getProcessTriple returns a triple with the system's macOS version.
The function sys::getDefaultTargetTriple does this version adjustment as well. However, it seems wrong to me (the default target OS might not be the host OS). I left it alone in this patch to avoid breaking things, but I think that the version adjustment in sys::getDefaultTargetTriple should check that the host OS is the same as the target OS before making the adjustment.
I'm not sure if it's possible to test this change (Please let me know if I'm wrong though). I do have a commit in Clang r305678 (that I reverted for now) that depends on this change.