================ @@ -1938,11 +1942,22 @@ struct DarwinPlatform { SourceKind Kind; DarwinPlatformKind Platform; DarwinEnvironmentKind Environment = DarwinEnvironmentKind::NativeEnvironment; - VersionTuple NativeTargetVersion; - std::string OSVersion; - bool HasOSVersion = true, InferSimulatorFromArch = true; + // When compiling for a zippered target, this means both target & + // target variant is set on the command line, ZipperedOSVersion holds the + // OSVersion tied to the main target value. + VersionTuple ZipperedOSVersion; + // We allow multiple ways to set or default the OS + // version used for compilation. The ResolvedOSVersion always represents what + // will be used. + VersionTuple ResolvedOSVersion; ---------------- cyndyishida wrote:
I think `DarwinPlatform` is intended to be a lightweight type for representing platform info from various arguments, while `Darwin::AddDeploymentTarget` is the core logic for mapping it back to the target triple for CC1. It has direct access to objects like the `Driver` to be able to report errors when attempting to resolve the OS version. For now, I want to preserve that behavior. However, to address the overarching concerns I have: * changed `VersionTuple ResolvedOSVersion` to `std::optional<VersionTuple> UnderlyingOSVersion` * replaced `providedOSVersion` with `hasOSVersion` and simplified setting UnderlyingOSVersion, to no longer worry about what existed at the construction of the `DarwinPlatform` object. * Introduce `takeOSVersion()` that should be called when the driver has resolved the OSVersion as far as the `DarwinPlatform` object is concerned. * renamed an unrelated `getOSVersion` to `getInferredOSVersion` https://github.com/llvm/llvm-project/pull/142013 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits