[Lldb-commits] [lldb] [LLDB] Add an assert to verify sign_bit_pos is within the valid range (NFC) (PR #95678)

Shivam Gupta via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 26 02:02:44 PDT 2024


================
@@ -746,27 +746,18 @@ Status Scalar::SetValueFromData(const DataExtractor &data,
 bool Scalar::SignExtend(uint32_t sign_bit_pos) {
   const uint32_t max_bit_pos = GetByteSize() * 8;
 
-  if (sign_bit_pos < max_bit_pos) {
-    switch (m_type) {
-    case Scalar::e_void:
-    case Scalar::e_float:
-      return false;
+  assert(sign_bit_pos <= max_bit_pos);
----------------
xgupta wrote:

Yes, I have realized this now, asserts are discoursed in the LLDB debugger and it mentions in docs - https://lldb.llvm.org/resources/contributing.html#error-handling-and-use-of-assertions-in-lldb.

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


More information about the lldb-commits mailing list