LLDB  mainline
ClangPersistentVariables.h
Go to the documentation of this file.
1 //===-- ClangPersistentVariables.h ------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef liblldb_ClangPersistentVariables_h_
10 #define liblldb_ClangPersistentVariables_h_
11 
12 #include "llvm/ADT/DenseMap.h"
13 
15 #include "ClangModulesDeclVendor.h"
16 
18 
19 namespace lldb_private {
20 
21 /// \class ClangPersistentVariables ClangPersistentVariables.h
22 /// "lldb/Expression/ClangPersistentVariables.h" Manages persistent values
23 /// that need to be preserved between expression invocations.
24 ///
25 /// A list of variables that can be accessed and updated by any expression. See
26 /// ClangPersistentVariable for more discussion. Also provides an increasing,
27 /// 0-based counter for naming result variables.
29 public:
31 
32  ~ClangPersistentVariables() override = default;
33 
34  // llvm casting support
35  static bool classof(const PersistentExpressionState *pv) {
37  }
38 
39  lldb::ExpressionVariableSP
40  CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp) override;
41 
42  lldb::ExpressionVariableSP CreatePersistentVariable(
43  ExecutionContextScope *exe_scope, ConstString name,
44  const CompilerType &compiler_type, lldb::ByteOrder byte_order,
45  uint32_t addr_byte_size) override;
46 
47  void RemovePersistentVariable(lldb::ExpressionVariableSP variable) override;
48  llvm::StringRef
49  GetPersistentVariablePrefix(bool is_error) const override {
50  return "$";
51  }
52 
53  void RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl);
54 
55  clang::NamedDecl *GetPersistentDecl(ConstString name);
56 
58  m_hand_loaded_clang_modules.push_back(module);
59  }
60 
62  return m_hand_loaded_clang_modules;
63  }
64 
65 private:
66  uint32_t m_next_persistent_variable_id; ///< The counter used by
67  ///GetNextResultName().
68 
69  typedef llvm::DenseMap<const char *, clang::NamedDecl *> PersistentDeclMap;
70  PersistentDeclMap
71  m_persistent_decls; ///< Persistent entities declared by the user.
72 
74  m_hand_loaded_clang_modules; ///< These are Clang modules we hand-loaded;
75  ///these are the highest-
76  ///< priority source for macros.
77 };
78 
79 } // namespace lldb_private
80 
81 #endif // liblldb_ClangPersistentVariables_h_
clang::NamedDecl * GetPersistentDecl(ConstString name)
llvm::StringRef GetPersistentVariablePrefix(bool is_error) const override
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
void AddHandLoadedClangModule(ClangModulesDeclVendor::ModuleID module)
~ClangPersistentVariables() override=default
"lldb/Expression/ClangPersistentVariables.h" Manages persistent values that need to be preserved betw...
void RegisterPersistentDecl(ConstString name, clang::NamedDecl *decl)
void RemovePersistentVariable(lldb::ExpressionVariableSP variable) override
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
static bool classof(const PersistentExpressionState *pv)
const ClangModulesDeclVendor::ModuleVector & GetHandLoadedClangModules()
A uniqued constant string class.
Definition: ConstString.h:38
lldb::ExpressionVariableSP CreatePersistentVariable(const lldb::ValueObjectSP &valobj_sp) override