diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-04-30 23:59:15 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-04-30 23:59:15 +0000 |
commit | 5435f78046ee39f7bec4be7833cb0a86043f8aa2 (patch) | |
tree | df2c9233d60e383508bad100b33fabb427ed43c8 /lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp | |
parent | 763cd2a98a61083593cd8f167bf6d27aa7eb6d96 (diff) | |
download | bcm5719-llvm-5435f78046ee39f7bec4be7833cb0a86043f8aa2.tar.gz bcm5719-llvm-5435f78046ee39f7bec4be7833cb0a86043f8aa2.zip |
Move the persistent variable counter into Target
so it can be shared across multiple language plugins.
In a multi-language project it is counterintuitive to have a result
variables reuse numbers just because they are using a different
language plugin in LLDB (but not for example, when they are
Objective-C versus C++, since they are both handled by Clang).
This is NFC on llvm.org except for the Go plugin.
rdar://problem/39299889
Differential Revision: https://reviews.llvm.org/D46083
llvm-svn: 331234
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index 48c006a2cf7..43ac4c6747a 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -272,7 +272,7 @@ GoUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, PersistentExpressionState *pv = target->GetPersistentExpressionStateForLanguage(eLanguageTypeGo); if (pv != nullptr) { - result->SetName(pv->GetNextPersistentVariableName()); + result->SetName(pv->GetNextPersistentVariableName(*target)); pv->AddVariable(result); } return lldb::eExpressionCompleted; @@ -650,11 +650,12 @@ ValueObjectSP GoUserExpression::GoInterpreter::VisitCallExpr( GoPersistentExpressionState::GoPersistentExpressionState() : PersistentExpressionState(eKindGo) {} -ConstString GoPersistentExpressionState::GetNextPersistentVariableName() { +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", - m_next_persistent_variable_id++); + target.GetNextPersistentVariableIndex()); ConstString name(name_cstr); return name; } |