[Lldb-commits] [lldb] [LLDB] Remove redundant check in DemangledNameInfo::hasBasename (PR #142139)

via lldb-commits lldb-commits at lists.llvm.org
Fri May 30 05:42:33 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

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
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;
   }
 };
 

``````````

</details>


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


More information about the lldb-commits mailing list