[lld] [lld][NFC] Remove unnecessary else statements. (PR #69451)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 05:02:50 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld

Author: Jacek Caban (cjacek)

<details>
<summary>Changes</summary>

Follow up addressing #<!-- -->69099 review comment.

---
Full diff: https://github.com/llvm/llvm-project/pull/69451.diff


1 Files Affected:

- (modified) lld/COFF/Chunks.h (+7-14) 


``````````diff
diff --git a/lld/COFF/Chunks.h b/lld/COFF/Chunks.h
index 4e500cafd3ce4a2..ca125a19c3f3e6d 100644
--- a/lld/COFF/Chunks.h
+++ b/lld/COFF/Chunks.h
@@ -386,51 +386,44 @@ class SectionChunk final : public Chunk {
 inline size_t Chunk::getSize() const {
   if (isa<SectionChunk>(this))
     return static_cast<const SectionChunk *>(this)->getSize();
-  else
-    return static_cast<const NonSectionChunk *>(this)->getSize();
+  return static_cast<const NonSectionChunk *>(this)->getSize();
 }
 
 inline uint32_t Chunk::getOutputCharacteristics() const {
   if (isa<SectionChunk>(this))
     return static_cast<const SectionChunk *>(this)->getOutputCharacteristics();
-  else
-    return static_cast<const NonSectionChunk *>(this)
+  return static_cast<const NonSectionChunk *>(this)
         ->getOutputCharacteristics();
 }
 
 inline void Chunk::writeTo(uint8_t *buf) const {
   if (isa<SectionChunk>(this))
     static_cast<const SectionChunk *>(this)->writeTo(buf);
-  else
-    static_cast<const NonSectionChunk *>(this)->writeTo(buf);
+  static_cast<const NonSectionChunk *>(this)->writeTo(buf);
 }
 
 inline StringRef Chunk::getSectionName() const {
   if (isa<SectionChunk>(this))
     return static_cast<const SectionChunk *>(this)->getSectionName();
-  else
-    return static_cast<const NonSectionChunk *>(this)->getSectionName();
+  return static_cast<const NonSectionChunk *>(this)->getSectionName();
 }
 
 inline void Chunk::getBaserels(std::vector<Baserel> *res) {
   if (isa<SectionChunk>(this))
     static_cast<SectionChunk *>(this)->getBaserels(res);
-  else
-    static_cast<NonSectionChunk *>(this)->getBaserels(res);
+  static_cast<NonSectionChunk *>(this)->getBaserels(res);
 }
 
 inline StringRef Chunk::getDebugName() const {
   if (isa<SectionChunk>(this))
     return static_cast<const SectionChunk *>(this)->getDebugName();
-  else
-    return static_cast<const NonSectionChunk *>(this)->getDebugName();
+  return static_cast<const NonSectionChunk *>(this)->getDebugName();
 }
 
 inline MachineTypes Chunk::getMachine() const {
   if (isa<SectionChunk>(this))
     return static_cast<const SectionChunk *>(this)->getMachine();
-  else
-    return static_cast<const NonSectionChunk *>(this)->getMachine();
+  return static_cast<const NonSectionChunk *>(this)->getMachine();
 }
 
 inline chpe_range_type Chunk::getArm64ECRangeType() const {

``````````

</details>


https://github.com/llvm/llvm-project/pull/69451


More information about the llvm-commits mailing list