[Lldb-commits] [lldb] [lldb-dap] Allow setting scoped enums values (PR #192028)

Ebuka Ezike via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 17 08:54:42 PDT 2026


================
@@ -64,7 +64,14 @@ SetVariableRequestHandler::Run(const SetVariableArguments &args) const {
   lldb::SBFrame frame = variable.GetFrame();
   std::string expression = llvm::StringRef(args.value).trim().str();
   lldb::SBValue result = EvaluateExpression(dap.target, frame, expression);
-  const char *value = result.IsValid() ? result.GetValue() : expression.c_str();
+  const char *value = [&]() {
+    if (!result.IsValid())
+      return expression.c_str();
+    lldb::SBType type = result.GetType();
+    if (type.IsScopedEnumerationType())
----------------
da-viper wrote:

This will produce the wrong result in swift and rust as their representation can store arbitrary values (more like std::variant). 

something like 
`if (type.IsScopedEnumerationType() and (type.GetTypeFlags() & lldb.eTypeIsScalar))` should work. but will have to update the type system clang to mark enums as scalars. (In another PR). 


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


More information about the lldb-commits mailing list