ELF2: Reduce nesting by returning early. NFC.
llvm-svn: 247168
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 04dec72..c3c90e0 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -50,22 +50,20 @@
if (L != R)
return -1;
-
if (!L.first || !L.second)
return 1;
if (isCommon()) {
- if (Other->isCommon()) {
- auto *ThisC = cast<DefinedCommon<ELFT>>(this);
- auto *OtherC = cast<DefinedCommon<ELFT>>(Other);
- typename DefinedCommon<ELFT>::uintX_t MaxAlign =
- std::max(ThisC->MaxAlignment, OtherC->MaxAlignment);
- if (ThisC->Sym.st_size >= OtherC->Sym.st_size) {
- ThisC->MaxAlignment = MaxAlign;
- return 1;
- }
- OtherC->MaxAlignment = MaxAlign;
+ if (!Other->isCommon())
return -1;
+ auto *ThisC = cast<DefinedCommon<ELFT>>(this);
+ auto *OtherC = cast<DefinedCommon<ELFT>>(Other);
+ typename DefinedCommon<ELFT>::uintX_t MaxAlign =
+ std::max(ThisC->MaxAlignment, OtherC->MaxAlignment);
+ if (ThisC->Sym.st_size >= OtherC->Sym.st_size) {
+ ThisC->MaxAlignment = MaxAlign;
+ return 1;
}
+ OtherC->MaxAlignment = MaxAlign;
return -1;
}
if (Other->isCommon())