diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
| commit | f73363f1dd94996356cefbf24388f561891acf0b (patch) | |
| tree | e3c31248bdb36eaec5fd833490d4278162dba2a0 /source/Plugins/ExpressionParser/Go/GoUserExpression.cpp | |
| parent | 160ee69dd7ae18978f4068116777639ea98dc951 (diff) | |
Notes
Diffstat (limited to 'source/Plugins/ExpressionParser/Go/GoUserExpression.cpp')
| -rw-r--r-- | source/Plugins/ExpressionParser/Go/GoUserExpression.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index f4b8cfbe03d4..3a10a1dc767a 100644 --- a/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -171,12 +171,11 @@ private: VariableSP FindGlobalVariable(TargetSP target, llvm::Twine name) { ConstString fullname(name.str()); VariableList variable_list; - const bool append = true; if (!target) { return nullptr; } - const uint32_t match_count = target->GetImages().FindGlobalVariables( - fullname, append, 1, variable_list); + const uint32_t match_count = + target->GetImages().FindGlobalVariables(fullname, 1, variable_list); if (match_count == 1) { return variable_list.GetVariableAtIndex(0); } @@ -272,7 +271,8 @@ GoUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, PersistentExpressionState *pv = target->GetPersistentExpressionStateForLanguage(eLanguageTypeGo); if (pv != nullptr) { - result->SetName(pv->GetNextPersistentVariableName()); + result->SetName(pv->GetNextPersistentVariableName( + *target, pv->GetPersistentVariablePrefix())); pv->AddVariable(result); } return lldb::eExpressionCompleted; @@ -400,8 +400,7 @@ ValueObjectSP GoUserExpression::GoInterpreter::VisitIdent(const GoASTIdent *e) { val = m_frame->GetValueObjectForFrameVariable(var_sp, m_use_dynamic); else { // When a variable is on the heap instead of the stack, go records a - // variable - // '&x' instead of 'x'. + // variable '&x' instead of 'x'. var_sp = var_list_sp->FindVariable(ConstString("&" + varname)); if (var_sp) { val = m_frame->GetValueObjectForFrameVariable(var_sp, m_use_dynamic); @@ -651,15 +650,6 @@ ValueObjectSP GoUserExpression::GoInterpreter::VisitCallExpr( GoPersistentExpressionState::GoPersistentExpressionState() : PersistentExpressionState(eKindGo) {} -ConstString GoPersistentExpressionState::GetNextPersistentVariableName() { - char name_cstr[256]; - // We can't use the same variable format as clang. - ::snprintf(name_cstr, sizeof(name_cstr), "$go%u", - m_next_persistent_variable_id++); - ConstString name(name_cstr); - return name; -} - void GoPersistentExpressionState::RemovePersistentVariable( lldb::ExpressionVariableSP variable) { RemoveVariable(variable); |
