diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 0592601446877300d211f995d578eb102b66e96c..ffb1266b97f7f7490567b3356abeb78822341b04 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -1020,24 +1020,15 @@ static bool hasTrivialSetExpr(const ObjCPropertyImplDecl *PID) { return false; } -bool UseOptimizedSetter(CodeGenModule &CGM) { +static bool UseOptimizedSetter(CodeGenModule &CGM) { if (CGM.getLangOptions().getGC() != LangOptions::NonGC) return false; const TargetInfo &Target = CGM.getContext().getTargetInfo(); - StringRef TargetPlatform = Target.getPlatformName(); - if (TargetPlatform.empty()) - return false; - VersionTuple TargetMinVersion = Target.getPlatformMinVersion(); - - if (TargetPlatform.compare("macosx") || - TargetMinVersion.getMajor() <= 9) + + if (Target.getPlatformName() != "macosx") return false; - - unsigned minor = 0; - if (llvm::Optional Minor = TargetMinVersion.getMinor()) - minor = *Minor; - - return (minor >= 8); + + return Target.getPlatformMinVersion() >= VersionTuple(10, 8); } void