[Lldb-commits] [lldb] r370126 - Revert "[lldb] Move redundant persistent variable counter to ClangPersistentVariables"
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 27 15:50:40 PDT 2019
Author: adrian
Date: Tue Aug 27 15:50:40 2019
New Revision: 370126
URL: http://llvm.org/viewvc/llvm-project?rev=370126&view=rev
Log:
Revert "[lldb] Move redundant persistent variable counter to ClangPersistentVariables"
This reverts commit r367842 since it wasn't quite as NFC as advertised
and broke Swift support. See https://reviews.llvm.org/D46083 for the
rationale behind the original functionality.
rdar://problem/54619322
Modified:
lldb/trunk/include/lldb/Expression/ExpressionVariable.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Expression/ExpressionVariable.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
Modified: lldb/trunk/include/lldb/Expression/ExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ExpressionVariable.h?rev=370126&r1=370125&r2=370126&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ExpressionVariable.h (original)
+++ lldb/trunk/include/lldb/Expression/ExpressionVariable.h Tue Aug 27 15:50:40 2019
@@ -223,8 +223,8 @@ public:
uint32_t addr_byte_size) = 0;
/// Return a new persistent variable name with the specified prefix.
- virtual ConstString GetNextPersistentVariableName(Target &target,
- llvm::StringRef prefix) = 0;
+ ConstString GetNextPersistentVariableName(Target &target,
+ llvm::StringRef prefix);
virtual llvm::StringRef
GetPersistentVariablePrefix(bool is_error = false) const = 0;
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=370126&r1=370125&r2=370126&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue Aug 27 15:50:40 2019
@@ -1106,6 +1106,11 @@ public:
lldb::ExpressionVariableSP GetPersistentVariable(ConstString name);
+ /// Return the next available number for numbered persistent variables.
+ unsigned GetNextPersistentVariableIndex() {
+ return m_next_persistent_variable_index++;
+ }
+
lldb::addr_t GetPersistentSymbol(ConstString name);
/// This method will return the address of the starting function for
@@ -1315,6 +1320,7 @@ protected:
bool m_valid;
bool m_suppress_stop_hooks;
bool m_is_dummy_target;
+ unsigned m_next_persistent_variable_index = 0;
static void ImageSearchPathsChanged(const PathMappingList &path_list,
void *baton);
Modified: lldb/trunk/source/Expression/ExpressionVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ExpressionVariable.cpp?rev=370126&r1=370125&r2=370126&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ExpressionVariable.cpp (original)
+++ lldb/trunk/source/Expression/ExpressionVariable.cpp Tue Aug 27 15:50:40 2019
@@ -76,3 +76,13 @@ void PersistentExpressionState::Register
}
}
}
+
+ConstString PersistentExpressionState::GetNextPersistentVariableName(
+ Target &target, llvm::StringRef Prefix) {
+ llvm::SmallString<64> name;
+ {
+ llvm::raw_svector_ostream os(name);
+ os << Prefix << target.GetNextPersistentVariableIndex();
+ }
+ return ConstString(name);
+}
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h?rev=370126&r1=370125&r2=370126&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h Tue Aug 27 15:50:40 2019
@@ -46,16 +46,6 @@ public:
void RemovePersistentVariable(lldb::ExpressionVariableSP variable) override;
- ConstString GetNextPersistentVariableName(Target &target,
- llvm::StringRef prefix) override {
- llvm::SmallString<64> name;
- {
- llvm::raw_svector_ostream os(name);
- os << prefix << m_next_persistent_variable_id++;
- }
- return ConstString(name);
- }
-
llvm::StringRef GetPersistentVariablePrefix(bool is_error) const override {
return "$";
}
More information about the lldb-commits
mailing list