Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lld][NFC] Remove unnecessary else statements. #69451

Merged
merged 1 commit into from
Oct 20, 2023
Merged

Conversation

cjacek
Copy link
Contributor

@cjacek cjacek commented Oct 18, 2023

Follow up addressing #69099 review comment.

@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2023

@llvm/pr-subscribers-lld-coff
@llvm/pr-subscribers-platform-windows

@llvm/pr-subscribers-lld

Author: Jacek Caban (cjacek)

Changes

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 --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 {

@github-actions
Copy link

github-actions bot commented Oct 18, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

@rnk
Copy link
Collaborator

rnk commented Oct 18, 2023

Looks good, but it looks like check-lld failed:
https://buildkite.com/llvm-project/github-pull-requests/builds/8476#018b42ac-9aaf-4930-9f54-ff29d0d3af45
Can you investigate?

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@cjacek
Copy link
Contributor Author

cjacek commented Oct 18, 2023

Looks good, but it looks like check-lld failed: https://buildkite.com/llvm-project/github-pull-requests/builds/8476#018b42ac-9aaf-4930-9f54-ff29d0d3af45 Can you investigate?

I pushed a fixup, sorry about that.

Copy link
Collaborator

@rnk rnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants