[Lldb-commits] [lldb] [lldb] Assert on invalid default {S, U}Int64 (NFC) (PR #126590)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 10 14:47:37 PST 2025


================
@@ -68,11 +68,10 @@ class OptionValueSInt64 : public Cloneable<OptionValueSInt64, OptionValue> {
   }
 
   bool SetDefaultValue(int64_t value) {
-    if (value >= m_min_value && value <= m_max_value) {
-      m_default_value = value;
-      return true;
-    }
-    return false;
+    assert(value >= m_min_value && value <= m_max_value &&
----------------
bulbazord wrote:

A few things I'd like to make sure of:
- What happens in release configurations where assertions are compiled out? Might this allow you to set an invalid value?
- Can you call `SetDefaultValue` by typing a command in lldb? If so, an assertion seems like the wrong way of catching this. I ask because this is in OptionValue, which are involved in parsing commands in LLDB.

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


More information about the lldb-commits mailing list