[lld] ee61dc5 - [lld-macho][nfc] Reduce nesting of code added in D130125
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 23 10:16:17 PDT 2022
Author: Jez Ng
Date: 2022-07-23T13:16:00-04:00
New Revision: ee61dc5f6c57038e1247e048d43d543dd2340cf1
URL: https://github.com/llvm/llvm-project/commit/ee61dc5f6c57038e1247e048d43d543dd2340cf1
DIFF: https://github.com/llvm/llvm-project/commit/ee61dc5f6c57038e1247e048d43d543dd2340cf1.diff
LOG: [lld-macho][nfc] Reduce nesting of code added in D130125
Added:
Modified:
lld/MachO/SyntheticSections.cpp
Removed:
################################################################################
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;
}
}
}
More information about the llvm-commits
mailing list