summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ExpressionParser
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/Plugins/ExpressionParser
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/Plugins/ExpressionParser')
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp3
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h18
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp2
6 files changed, 21 insertions, 8 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
index 5bba7a9c2bc..7845d04f01f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
@@ -464,7 +464,7 @@ ASTResultSynthesizer::MaybeRecordPersistentType(TypeDecl *D)
D);
if (TypeDecl *TypeDecl_scratch = dyn_cast<TypeDecl>(D_scratch))
- m_target.GetPersistentVariables().RegisterPersistentType(name_cs, TypeDecl_scratch);
+ llvm::cast<ClangPersistentVariables>(m_target.GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC)->GetPersistentExpressionState())->RegisterPersistentType(name_cs, TypeDecl_scratch);
}
void
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 533f7c268c7..40fb6c8b0a7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -104,7 +104,7 @@ ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx,
if (target)
{
- m_parser_vars->m_persistent_vars = &target->GetPersistentVariables();
+ m_parser_vars->m_persistent_vars = llvm::cast<ClangPersistentVariables>(target->GetScratchTypeSystemForLanguage(eLanguageTypeC)->GetPersistentExpressionState());
if (!target->GetScratchClangASTContext())
return false;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 8b679a9edc9..af148b4e761 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -331,7 +331,8 @@ ClangExpressionParser::ClangExpressionParser (ExecutionContextScope *exe_scope,
if (ClangModulesDeclVendor *decl_vendor = target_sp->GetClangModulesDeclVendor())
{
- std::unique_ptr<PPCallbacks> pp_callbacks(new LLDBPreprocessorCallbacks(*decl_vendor, target_sp->GetPersistentVariables()));
+ ClangPersistentVariables *clang_persistent_vars = llvm::cast<ClangPersistentVariables>(target_sp->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC)->GetPersistentExpressionState());
+ std::unique_ptr<PPCallbacks> pp_callbacks(new LLDBPreprocessorCallbacks(*decl_vendor, *clang_persistent_vars));
m_pp_callbacks = static_cast<LLDBPreprocessorCallbacks*>(pp_callbacks.get());
m_compiler->getPreprocessor().addPPCallbacks(std::move(pp_callbacks));
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
index beaa1d69da3..cadccecffeb 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
@@ -20,7 +20,7 @@ using namespace lldb;
using namespace lldb_private;
ClangPersistentVariables::ClangPersistentVariables () :
- ExpressionVariableList(),
+ lldb_private::PersistentExpressionState(LLVMCastKind::eKindClang),
m_next_persistent_variable_id (0)
{
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
index 828badb9564..4c6a19d3e5c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
@@ -13,6 +13,8 @@
#include "ClangExpressionVariable.h"
#include "ClangModulesDeclVendor.h"
+#include "lldb/Expression/ExpressionVariable.h"
+
#include "llvm/ADT/DenseMap.h"
namespace lldb_private
@@ -26,7 +28,7 @@ namespace lldb_private
/// ClangPersistentVariable for more discussion. Also provides an increasing,
/// 0-based counter for naming result variables.
//----------------------------------------------------------------------
-class ClangPersistentVariables : public ExpressionVariableList
+class ClangPersistentVariables : public PersistentExpressionState
{
public:
@@ -34,6 +36,16 @@ public:
/// Constructor
//----------------------------------------------------------------------
ClangPersistentVariables ();
+
+ ~ClangPersistentVariables () { }
+
+ //------------------------------------------------------------------
+ // llvm casting support
+ //------------------------------------------------------------------
+ static bool classof(const PersistentExpressionState *pv)
+ {
+ return pv->getKind() == PersistentExpressionState::eKindClang;
+ }
lldb::ExpressionVariableSP
CreatePersistentVariable (const lldb::ValueObjectSP &valobj_sp);
@@ -53,10 +65,10 @@ public:
/// A string that contains the next persistent variable name.
//----------------------------------------------------------------------
ConstString
- GetNextPersistentVariableName ();
+ GetNextPersistentVariableName () override;
void
- RemovePersistentVariable (lldb::ExpressionVariableSP variable);
+ RemovePersistentVariable (lldb::ExpressionVariableSP variable) override;
void
RegisterPersistentType (const ConstString &name,
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 3d86c521738..c5e125fc07d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -357,7 +357,7 @@ ClangUserExpression::Parse (Stream &error_stream,
if (ClangModulesDeclVendor *decl_vendor = m_target->GetClangModulesDeclVendor())
{
- const ClangModulesDeclVendor::ModuleVector &hand_imported_modules = m_target->GetPersistentVariables().GetHandLoadedClangModules();
+ const ClangModulesDeclVendor::ModuleVector &hand_imported_modules = llvm::cast<ClangPersistentVariables>(m_target->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC)->GetPersistentExpressionState())->GetHandLoadedClangModules();
ClangModulesDeclVendor::ModuleVector modules_for_macros;
for (ClangModulesDeclVendor::ModuleID module : hand_imported_modules)
OpenPOWER on IntegriCloud