bulbazord created this revision. bulbazord added reviewers: JDevlieghere, aprantl, Michael137, fdeazeve. Herald added a project: All. bulbazord requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
These don't really need to be in the ConstString StringPool. Note that they still end up there because we need to wrap them in ConstStrings to use them with certain APIs, but we can stop creating them as ConstStrings to start. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D152324 Files: lldb/include/lldb/Expression/ExpressionVariable.h lldb/source/Core/ValueObject.cpp lldb/source/Expression/Materializer.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp lldb/source/Target/ABI.cpp
Index: lldb/source/Target/ABI.cpp =================================================================== --- lldb/source/Target/ABI.cpp +++ lldb/source/Target/ABI.cpp @@ -93,8 +93,8 @@ if (!persistent_expression_state) return {}; - ConstString persistent_variable_name = - persistent_expression_state->GetNextPersistentVariableName(); + ConstString persistent_variable_name = ConstString( + persistent_expression_state->GetNextPersistentVariableName()); lldb::ValueObjectSP const_valobj_sp; Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -1015,7 +1015,7 @@ } ConstString ClangUserExpression::ResultDelegate::GetName() { - return m_persistent_state->GetNextPersistentVariableName(false); + return ConstString(m_persistent_state->GetNextPersistentVariableName(false)); } void ClangUserExpression::ResultDelegate::DidDematerialize( Index: lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h +++ lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h @@ -55,7 +55,7 @@ void RemovePersistentVariable(lldb::ExpressionVariableSP variable) override; - ConstString GetNextPersistentVariableName(bool is_error = false) override; + std::string GetNextPersistentVariableName(bool is_error = false) override; /// Returns the next file name that should be used for user expressions. std::string GetNextExprFileName() { Index: lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp =================================================================== --- lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp +++ lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp @@ -124,7 +124,7 @@ return m_modules_decl_vendor_sp; } -ConstString +std::string ClangPersistentVariables::GetNextPersistentVariableName(bool is_error) { llvm::SmallString<64> name; { @@ -132,5 +132,5 @@ os << GetPersistentVariablePrefix(is_error) << m_next_persistent_variable_id++; } - return ConstString(name); + return std::string(name); } Index: lldb/source/Expression/Materializer.cpp =================================================================== --- lldb/source/Expression/Materializer.cpp +++ lldb/source/Expression/Materializer.cpp @@ -1041,9 +1041,10 @@ return; } - ConstString name = m_delegate - ? m_delegate->GetName() - : persistent_state->GetNextPersistentVariableName(); + ConstString name = + m_delegate + ? m_delegate->GetName() + : ConstString(persistent_state->GetNextPersistentVariableName()); lldb::ExpressionVariableSP ret = persistent_state->CreatePersistentVariable( exe_scope, name, m_type, map.GetByteOrder(), map.GetAddressByteSize()); Index: lldb/source/Core/ValueObject.cpp =================================================================== --- lldb/source/Core/ValueObject.cpp +++ lldb/source/Core/ValueObject.cpp @@ -3143,10 +3143,10 @@ if (!persistent_state) return nullptr; - ConstString name = persistent_state->GetNextPersistentVariableName(); + const std::string name = persistent_state->GetNextPersistentVariableName(); - ValueObjectSP const_result_sp = - ValueObjectConstResult::Create(target_sp.get(), GetValue(), name); + ValueObjectSP const_result_sp = ValueObjectConstResult::Create( + target_sp.get(), GetValue(), ConstString(name)); ExpressionVariableSP persistent_var_sp = persistent_state->CreatePersistentVariable(const_result_sp); Index: lldb/include/lldb/Expression/ExpressionVariable.h =================================================================== --- lldb/include/lldb/Expression/ExpressionVariable.h +++ lldb/include/lldb/Expression/ExpressionVariable.h @@ -221,7 +221,7 @@ uint32_t addr_byte_size) = 0; /// Return a new persistent variable name with the specified prefix. - virtual ConstString GetNextPersistentVariableName(bool is_error = false) = 0; + virtual std::string GetNextPersistentVariableName(bool is_error = false) = 0; virtual void RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits