Added the notion that a value object can be constant by adding:
bool ValueObject::GetIsConstant() const;
void ValueObject::SetIsConstant();
This will stop anything from being re-evaluated within the value object so
that constant result value objects can maintain their frozen values without
anything being updated or changed within the value object.
Made it so the ValueObjectConstResult can be constructed with an
lldb_private::Error object to allow for expression results to have errors.
Since ValueObject objects contain error objects, I changed the expression
evaluation in ClangUserExpression from
static Error
ClangUserExpression::Evaluate (ExecutionContext &exe_ctx,
const char *expr_cstr,
lldb::ValueObjectSP &result_valobj_sp);
to:
static lldb::ValueObjectSP
Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr);
Even though expression parsing is borked right now (pending fixes coming from
Sean Callanan), I filled in the implementation for:
SBValue SBFrame::EvaluateExpression (const char *expr);
Modified all expression code to deal with the above changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@115589 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangUserExpression.cpp b/source/Expression/ClangUserExpression.cpp
index ed50ea0..888a266 100644
--- a/source/Expression/ClangUserExpression.cpp
+++ b/source/Expression/ClangUserExpression.cpp
@@ -21,6 +21,7 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/StreamString.h"
+#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Expression/ClangExpressionDeclMap.h"
#include "lldb/Expression/ClangExpressionParser.h"
#include "lldb/Expression/ClangFunction.h"
@@ -338,12 +339,11 @@
}
-Error
-ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr, lldb::ValueObjectSP &result_valobj_sp)
+lldb::ValueObjectSP
+ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr)
{
Error error;
- result_valobj_sp.reset();
-
+ lldb::ValueObjectSP result_valobj_sp;
ClangUserExpression user_expression (expr_cstr);
StreamString error_stream;
@@ -385,6 +385,9 @@
}
}
}
- return error;
+ if (result_valobj_sp.get() == NULL)
+ result_valobj_sp.reset (new ValueObjectConstResult (error));
+
+ return result_valobj_sp;
}
\ No newline at end of file