[LLDB] Update DIL assignment to respect ValueObject::CanSetValue - #217960
[LLDB] Update DIL assignment to respect ValueObject::CanSetValue#217960cmtice wants to merge 1 commit into
Conversation
This will prevent DIL from allowing users to try to assign new values in cases where that could lead to incorrect behavior.
🐧 Linux x64 Test Results
Failed Tests(click on a test name to see its output) lldb-apilldb-api.commands/frame/var-dil/expr/Assignment/TestFrameVarDILAssign.pyIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
🪟 Windows x64 Test Results
Failed Tests(click on a test name to see its output) lldb-apilldb-api.commands/frame/var-dil/expr/Assignment/TestFrameVarDILAssign.pylldb-unitlldb-unit.Target/_/TargetTests_exe/TestTypeSystemMap/GetScratchTypeSystemsIsOrderedByLanguageIf these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the |
|
@llvm/pr-subscribers-lldb Author: cmtice ChangesThis will prevent DIL from allowing users to try to assign new values in cases where that could lead to incorrect behavior. Full diff: https://github.com/llvm/llvm-project/pull/217960.diff 1 Files Affected:
diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp
index d448444b43eba..9be288173e8f3 100644
--- a/lldb/source/ValueObject/DILEval.cpp
+++ b/lldb/source/ValueObject/DILEval.cpp
@@ -971,6 +971,10 @@ llvm::Expected<lldb::ValueObjectSP>
Interpreter::EvaluateAssignment(lldb::ValueObjectSP lhs,
lldb::ValueObjectSP rhs, uint32_t location) {
+ // Verify that lhs can accept an assignment.
+ if (llvm::Error err = lhs->CanSetValue())
+ return err;
+
auto all_ok =
VerifyAssignmentTypes(lhs->GetCompilerType(), rhs->GetCompilerType());
if (!all_ok)
|
|
Need to change the error messages in tests when assigning to constants. I didn't quite understand from the discussions, will the check for optimizations eventually happen in this function as well? |
This will prevent DIL from allowing users to try to assign new values in cases where that could lead to incorrect behavior.