-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
[lldb] Remove dead code block (NFC) #94775
Conversation
@llvm/pr-subscribers-lldb Author: Shivam Gupta (xgupta) ChangesFixes #85985 lldb/source/Utility/Scalar.cpp:756:23: warning: Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition] Full diff: https://github.com/llvm/llvm-project/pull/94775.diff 1 Files Affected:
diff --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp
index c70c5e1079918..c680101aa9efa 100644
--- a/lldb/source/Utility/Scalar.cpp
+++ b/lldb/source/Utility/Scalar.cpp
@@ -753,9 +753,7 @@ bool Scalar::SignExtend(uint32_t sign_bit_pos) {
return false;
case Scalar::e_int:
- if (max_bit_pos == sign_bit_pos)
- return true;
- else if (sign_bit_pos < (max_bit_pos - 1)) {
+ if (sign_bit_pos < (max_bit_pos - 1)) {
llvm::APInt sign_bit = llvm::APInt::getSignMask(sign_bit_pos + 1);
llvm::APInt bitwize_and = m_integer & sign_bit;
if (bitwize_and.getBoolValue()) {
|
The change LGTM, but I have a few suggestions regarding the title and description:
|
Thanks, will update other PRs also as you suggested. |
gentle ping! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Random drive-by:
Should we add an |
The check that max_bit_pos == sign_bit_pos conflicts with the check that sign_bit_pos < max_bit_pos in the block surrounding it.
Originally found by cppcheck -
lldb/source/Utility/Scalar.cpp:756:23: warning: Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition]
Fixes #85985