[ELF2] Simplify the NOBITS sorting logic
As Rafael suggested in his review of r250190, we can simplify this by writing
it like the earlier checks.
llvm-svn: 250212
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 52d46b5..179e2f0 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -327,9 +327,10 @@
// them is a p_memsz that is larger than p_filesz. Seeing that it
// zeros the end of the PT_LOAD, so that has to correspond to the
// nobits sections.
- if ((A->getType() == SHT_NOBITS || B->getType() == SHT_NOBITS) &&
- A->getType() != B->getType())
- return A->getType() != SHT_NOBITS && B->getType() == SHT_NOBITS;
+ bool AIsNoBits = A->getType() == SHT_NOBITS;
+ bool BIsNoBits = B->getType() == SHT_NOBITS;
+ if (AIsNoBits != BIsNoBits)
+ return BIsNoBits;
// Some architectures have additional ordering restrictions for sections
// within the same PT_LOAD.