From ee61dc5f6c57038e1247e048d43d543dd2340cf1 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Sat, 23 Jul 2022 12:21:46 -0400 Subject: [PATCH] [lld-macho][nfc] Reduce nesting of code added in D130125 --- lld/MachO/SyntheticSections.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp index b47375106e79..8e7ca520336c 100644 --- a/lld/MachO/SyntheticSections.cpp +++ b/lld/MachO/SyntheticSections.cpp @@ -1680,17 +1680,17 @@ void ObjCImageInfoSection::finalizeContents() { ImageInfo inputInfo = parseImageInfo(file); info.hasCategoryClassProperties &= inputInfo.hasCategoryClassProperties; - if (inputInfo.swiftVersion != 0) { - if (info.swiftVersion != 0 && - info.swiftVersion != inputInfo.swiftVersion) { - error("Swift version mismatch: " + toString(firstFile) + - " has version " + swiftVersionString(info.swiftVersion) + - " but " + toString(file) + " has version " + - swiftVersionString(inputInfo.swiftVersion)); - } else { - info.swiftVersion = inputInfo.swiftVersion; - firstFile = file; - } + // swiftVersion 0 means no Swift is present, so no version checking required + if (inputInfo.swiftVersion == 0) + continue; + + if (info.swiftVersion != 0 && info.swiftVersion != inputInfo.swiftVersion) { + error("Swift version mismatch: " + toString(firstFile) + " has version " + + swiftVersionString(info.swiftVersion) + " but " + toString(file) + + " has version " + swiftVersionString(inputInfo.swiftVersion)); + } else { + info.swiftVersion = inputInfo.swiftVersion; + firstFile = file; } } }