Skip to content

[lldb] Make generic expr eval work with multiple toplevel generic params #5782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lldb/source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ class SwiftASTManipulatorBase {
unsigned GetType() override { return Type(); }
};

class VariableMetadataPersistent
: public SwiftASTManipulatorBase::VariableMetadata {
public:
VariableMetadataPersistent(
lldb::ExpressionVariableSP &persistent_variable_sp)
: m_persistent_variable_sp(persistent_variable_sp) {}

static constexpr unsigned Type() { return 'Pers'; }
unsigned GetType() override { return Type(); }
lldb::ExpressionVariableSP m_persistent_variable_sp;
};

class VariableMetadataVariable
: public SwiftASTManipulatorBase::VariableMetadata {
public:
VariableMetadataVariable(lldb::VariableSP &variable_sp)
: m_variable_sp(variable_sp) {}

static constexpr unsigned Type() { return 'Vari'; }
unsigned GetType() override { return Type(); }
lldb::VariableSP m_variable_sp;
};


typedef std::shared_ptr<VariableMetadata> VariableMetadataSP;

struct VariableInfo {
Expand All @@ -68,6 +92,9 @@ class SwiftASTManipulatorBase {
swift::VarDecl::Introducer GetVarIntroducer() const;
bool GetIsCaptureList() const;
bool IsMetadataPointer() const { return m_name.str().startswith("$τ"); }
bool IsOutermostMetadataPointer() const {
return m_name.str().startswith("$τ_0_");
}
bool IsSelf() const {
return !m_name.str().compare("$__lldb_injected_self");
}
Expand Down
Loading