-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Negate is_signed
variable for argument isUnsigned
in TypeSystemClang.cpp
#120794
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] Negate is_signed
variable for argument isUnsigned
in TypeSystemClang.cpp
#120794
Conversation
@llvm/pr-subscribers-lldb Author: Ilia Kuklin (kuilpd) ChangesFull diff: https://github.com/llvm/llvm-project/pull/120794.diff 1 Files Affected:
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 3ec25a2e8aa2df..06c04c992efc09 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -8534,7 +8534,7 @@ clang::EnumConstantDecl *TypeSystemClang::AddEnumerationValueToEnumerationType(
bool is_signed = false;
underlying_type.IsIntegerType(is_signed);
- llvm::APSInt value(enum_value_bit_size, is_signed);
+ llvm::APSInt value(enum_value_bit_size, !is_signed);
value = enum_value;
return AddEnumerationValueToEnumerationType(enum_type, decl, name, value);
|
This change doesn't really affect anything in lldb yet, but will be used and tested afterwards in #115005 |
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
Can we add a test for this in lldb/unittests/Symbol/TestTypeSystemClang.cpp
? We could call this API and then use EnumConstantDecl::getInitVal
to retrieve the APSInt
and make sure it's unsigned
auto *enum_decl = m_ast->AddEnumerationValueToEnumerationType( | ||
enum_type, nullptr, "minus_one", -1, 8); |
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.
Nit:
auto *enum_decl = m_ast->AddEnumerationValueToEnumerationType( | |
enum_type, nullptr, "minus_one", -1, 8); | |
auto *enum_decl = m_ast->AddEnumerationValueToEnumerationType( | |
enum_type, Declaration(), "minus_one", -1, 8); |
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, thanks! (one minor nit in the test)
No description provided.