summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp')
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
index 41d62a462ab4e..42afac9edb0d5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
@@ -1,4 +1,4 @@
-//===-- ClangPersistentVariables.cpp ----------------------------*- C++ -*-===//
+//===-- ClangPersistentVariables.cpp --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -7,9 +7,10 @@
//===----------------------------------------------------------------------===//
#include "ClangPersistentVariables.h"
+#include "ClangASTImporter.h"
+#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Core/Value.h"
-#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
@@ -82,7 +83,7 @@ ClangPersistentVariables::GetCompilerTypeFromPersistentDecl(
void ClangPersistentVariables::RegisterPersistentDecl(ConstString name,
clang::NamedDecl *decl,
- ClangASTContext *ctx) {
+ TypeSystemClang *ctx) {
PersistentDecl p = {decl, ctx};
m_persistent_decls.insert(std::make_pair(name.GetCString(), p));
@@ -99,3 +100,22 @@ clang::NamedDecl *
ClangPersistentVariables::GetPersistentDecl(ConstString name) {
return m_persistent_decls.lookup(name.GetCString()).m_decl;
}
+
+std::shared_ptr<ClangASTImporter>
+ClangPersistentVariables::GetClangASTImporter() {
+ if (!m_ast_importer_sp) {
+ m_ast_importer_sp = std::make_shared<ClangASTImporter>();
+ }
+ return m_ast_importer_sp;
+}
+
+ConstString
+ClangPersistentVariables::GetNextPersistentVariableName(bool is_error) {
+ llvm::SmallString<64> name;
+ {
+ llvm::raw_svector_ostream os(name);
+ os << GetPersistentVariablePrefix(is_error)
+ << m_next_persistent_variable_id++;
+ }
+ return ConstString(name);
+}