Skip to content

[LLDB] Remove redundant check in DemangledNameInfo::hasBasename #142139

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

Conversation

charles-zablit
Copy link
Contributor

This patch removes a redundant check in DemangledNameInfo::hasBasename.

Since the start and end range are unsigned, if end > start, then end is always greater than 0.

@llvmbot
Copy link
Member

llvmbot commented May 30, 2025

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

Changes

This patch removes a redundant check in DemangledNameInfo::hasBasename.

Since the start and end range are unsigned, if end > start, then end is always greater than 0.


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

1 Files Affected:

  • (modified) lldb/include/lldb/Core/DemangledNameInfo.h (+1-2)
diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h b/lldb/include/lldb/Core/DemangledNameInfo.h
index ab9bb3e211b66..4b5ba5e42b3b1 100644
--- a/lldb/include/lldb/Core/DemangledNameInfo.h
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -71,8 +71,7 @@ struct DemangledNameInfo {
 
   /// Returns \c true if this object holds a valid basename range.
   bool hasBasename() const {
-    return BasenameRange.second > BasenameRange.first &&
-           BasenameRange.second > 0;
+    return BasenameRange.second > BasenameRange.first;
   }
 };
 

Copy link
Member

@Michael137 Michael137 left a comment

Choose a reason for hiding this comment

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

thanks!

@Michael137 Michael137 merged commit aaa9c19 into llvm:main May 30, 2025
12 checks passed
charles-zablit added a commit to swiftlang/llvm-project that referenced this pull request May 30, 2025
adrian-prantl pushed a commit to swiftlang/llvm-project that referenced this pull request Jun 3, 2025
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants