@@ -659,23 +659,40 @@ toolchains::Darwin::addDeploymentTargetArgs(ArgStringList &Arguments,
659659static unsigned getDWARFVersionForTriple (const llvm::Triple &triple) {
660660 llvm::VersionTuple osVersion;
661661 const DarwinPlatformKind kind = getDarwinPlatformKind (triple);
662+ // Default to DWARF 2 on OS X 10.10 / iOS 8 and lower.
663+ // Default to DWARF 4 on OS X 10.11 - macOS 14 / iOS - iOS 17.
662664 switch (kind) {
663665 case DarwinPlatformKind::MacOS:
664666 triple.getMacOSXVersion (osVersion);
665667 if (osVersion < llvm::VersionTuple (10 , 11 ))
666668 return 2 ;
667- return 4 ;
669+ if (osVersion < llvm::VersionTuple (15 ))
670+ return 4 ;
671+ return 5 ;
668672 case DarwinPlatformKind::IPhoneOSSimulator:
669673 case DarwinPlatformKind::IPhoneOS:
670674 case DarwinPlatformKind::TvOS:
671675 case DarwinPlatformKind::TvOSSimulator:
672676 osVersion = triple.getiOSVersion ();
673- if (osVersion < llvm::VersionTuple (9 ))
674- return 2 ;
675- return 4 ;
676- default :
677- return 4 ;
677+ if (osVersion < llvm::VersionTuple (9 ))
678+ return 2 ;
679+ if (osVersion < llvm::VersionTuple (18 ))
680+ return 4 ;
681+ return 5 ;
682+ case DarwinPlatformKind::WatchOS:
683+ case DarwinPlatformKind::WatchOSSimulator:
684+ osVersion = triple.getWatchOSVersion ();
685+ if (osVersion < llvm::VersionTuple (11 ))
686+ return 4 ;
687+ return 5 ;
688+ case DarwinPlatformKind::VisionOS:
689+ case DarwinPlatformKind::VisionOSSimulator:
690+ osVersion = triple.getOSVersion ();
691+ if (osVersion < llvm::VersionTuple (2 ))
692+ return 4 ;
693+ return 5 ;
678694 }
695+ llvm_unreachable (" unsupported platform kind" );
679696}
680697
681698void toolchains::Darwin::addCommonFrontendArgs (
0 commit comments