This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Prevent mutation of CommandAlias::GetOptionArguments
ClosedPublic

Authored by kastiglione on May 7 2023, 5:02 PM.

Details

Summary

Fix a mutation of CommandAlias::m_option_args_sp, which resulted in cases where
aliases would fail to run on second, and subsequent times.

For example, an alias such as:

command alias p1 p 1

When run the second time, the following error would be reported to the user:

error: expression failed to parse:
error: <user expression 1>:1:1: expression is not assignable
--  1
^   ~

To fix this, CommandAlias::Desugar now constructs options to a freshly constructed
vector, rather than by appending to the results of GetOptionArguments.

rdar://107770836

Diff Detail

Event Timeline

kastiglione created this revision.May 7 2023, 5:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2023, 5:02 PM
kastiglione requested review of this revision.May 7 2023, 5:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2023, 5:02 PM
aprantl accepted this revision.May 8 2023, 9:05 AM
This revision is now accepted and ready to land.May 8 2023, 9:05 AM