summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2015-09-30 19:57:57 +0000
committerSean Callanan <scallanan@apple.com>2015-09-30 19:57:57 +0000
commit8f1f9a1be30ff0e260f451f18712dff7fa9a7273 (patch)
tree0f8b5547cb3eeee31a03e5b687b083f7af8013fa /lldb/source/Expression
parentf608111d1b6493ae9f8e8f0c24da57ca1aebb72f (diff)
downloadbcm5719-llvm-8f1f9a1be30ff0e260f451f18712dff7fa9a7273.tar.gz
bcm5719-llvm-8f1f9a1be30ff0e260f451f18712dff7fa9a7273.zip
Now persistent expression data no longer lives with the Target, but rather with
the corresponding TypeSystem. This makes sense because what kind of data there is -- and how it can be looked up -- depends on the language. Functionality that is common to all type systems is factored out into PersistentExpressionState. llvm-svn: 248934
Diffstat (limited to 'lldb/source/Expression')
-rw-r--r--lldb/source/Expression/ExpressionSourceCode.cpp4
-rw-r--r--lldb/source/Expression/ExpressionVariable.cpp4
-rw-r--r--lldb/source/Expression/Materializer.cpp23
-rw-r--r--lldb/source/Expression/UserExpression.cpp3
4 files changed, 28 insertions, 6 deletions
diff --git a/lldb/source/Expression/ExpressionSourceCode.cpp b/lldb/source/Expression/ExpressionSourceCode.cpp
index 4c0370389f3..d1342cf252d 100644
--- a/lldb/source/Expression/ExpressionSourceCode.cpp
+++ b/lldb/source/Expression/ExpressionSourceCode.cpp
@@ -13,6 +13,7 @@
#include "Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h"
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/StackFrame.h"
@@ -82,7 +83,8 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi
if (ClangModulesDeclVendor *decl_vendor = target->GetClangModulesDeclVendor())
{
- const ClangModulesDeclVendor::ModuleVector &hand_imported_modules = target->GetPersistentVariables().GetHandLoadedClangModules();
+ ClangPersistentVariables *persistent_vars = llvm::cast<ClangPersistentVariables>(target->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC)->GetPersistentExpressionState());
+ const ClangModulesDeclVendor::ModuleVector &hand_imported_modules = persistent_vars->GetHandLoadedClangModules();
ClangModulesDeclVendor::ModuleVector modules_for_macros;
for (ClangModulesDeclVendor::ModuleID module : hand_imported_modules)
diff --git a/lldb/source/Expression/ExpressionVariable.cpp b/lldb/source/Expression/ExpressionVariable.cpp
index 1f289b72f48..8bef60fdf1d 100644
--- a/lldb/source/Expression/ExpressionVariable.cpp
+++ b/lldb/source/Expression/ExpressionVariable.cpp
@@ -30,3 +30,7 @@ ExpressionVariable::GetValueBytes()
}
return NULL;
}
+
+PersistentExpressionState::~PersistentExpressionState ()
+{
+}
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp
index f7c9e2c623a..ebdad184e55 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -11,8 +11,7 @@
#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Core/ValueObjectVariable.h"
-#include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h"
-#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
+#include "lldb/Expression/ExpressionVariable.h"
#include "lldb/Expression/Materializer.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Symbol.h"
@@ -858,9 +857,25 @@ public:
return;
}
- ConstString name = target_sp->GetPersistentVariables().GetNextPersistentVariableName();
+ TypeSystem *type_system = target_sp->GetScratchTypeSystemForLanguage(m_type.GetMinimumLanguage());
- lldb::ExpressionVariableSP ret = ClangExpressionVariable::CreateVariableInList(target_sp->GetPersistentVariables(),
+ if (!type_system)
+ {
+ err.SetErrorString("Couldn't dematerialize a result variable: couldn't get the corresponding type system");
+ return;
+ }
+
+ PersistentExpressionState *persistent_state = type_system->GetPersistentExpressionState();
+
+ if (!persistent_state)
+ {
+ err.SetErrorString("Couldn't dematerialize a result variable: corresponding type system doesn't handle persistent variables");
+ return;
+ }
+
+ ConstString name = persistent_state->GetNextPersistentVariableName();
+
+ lldb::ExpressionVariableSP ret = ClangExpressionVariable::CreateVariableInList(*persistent_state,
exe_scope,
name,
m_type,
diff --git a/lldb/source/Expression/UserExpression.cpp b/lldb/source/Expression/UserExpression.cpp
index 1537e031d37..a493cc80d88 100644
--- a/lldb/source/Expression/UserExpression.cpp
+++ b/lldb/source/Expression/UserExpression.cpp
@@ -34,6 +34,7 @@
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
@@ -586,7 +587,7 @@ UserExpression::Evaluate (ExecutionContext &exe_ctx,
if (options.GetResultIsInternal() && expr_result && process)
{
- process->GetTarget().GetPersistentVariables().RemovePersistentVariable (expr_result);
+ process->GetTarget().GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC)->GetPersistentExpressionState()->RemovePersistentVariable (expr_result);
}
if (execution_results != lldb::eExpressionCompleted)
OpenPOWER on IntegriCloud