diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-04-30 23:59:17 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-04-30 23:59:17 +0000 |
commit | 03219f7f64b743cd53077280d139902b0e915365 (patch) | |
tree | 81d48657fc2fe335eb268531b1882b61d3fee4e0 /lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp | |
parent | 5435f78046ee39f7bec4be7833cb0a86043f8aa2 (diff) | |
download | bcm5719-llvm-03219f7f64b743cd53077280d139902b0e915365.tar.gz bcm5719-llvm-03219f7f64b743cd53077280d139902b0e915365.zip |
Refactor GetNextPersistentVariableName into a non-virtual method
that takes a prefix string. This simplifies the implementation and
allows plugins such as the Swift plugin to supply different prefixes
for return and error variables.
rdar://problem/39299889
Differential Revision: https://reviews.llvm.org/D46088
llvm-svn: 331235
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index 43ac4c6747a..9212e18bd84 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -272,7 +272,8 @@ GoUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, PersistentExpressionState *pv = target->GetPersistentExpressionStateForLanguage(eLanguageTypeGo); if (pv != nullptr) { - result->SetName(pv->GetNextPersistentVariableName(*target)); + result->SetName(pv->GetNextPersistentVariableName( + *target, pv->GetPersistentVariablePrefix())); pv->AddVariable(result); } return lldb::eExpressionCompleted; @@ -650,16 +651,6 @@ ValueObjectSP GoUserExpression::GoInterpreter::VisitCallExpr( GoPersistentExpressionState::GoPersistentExpressionState() : PersistentExpressionState(eKindGo) {} -ConstString -GoPersistentExpressionState::GetNextPersistentVariableName(Target &target) { - char name_cstr[256]; - // We can't use the same variable format as clang. - ::snprintf(name_cstr, sizeof(name_cstr), "$go%u", - target.GetNextPersistentVariableIndex()); - ConstString name(name_cstr); - return name; -} - void GoPersistentExpressionState::RemovePersistentVariable( lldb::ExpressionVariableSP variable) { RemoveVariable(variable); |