[all-commits] [llvm/llvm-project] 765237: [lldb] Prevent mutation of CommandAlias::GetOption...

Dave Lee via All-commits all-commits at lists.llvm.org
Mon May 8 09:45:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 765237779ce4dbb60f4faf9ebc91386ce5218e15
      https://github.com/llvm/llvm-project/commit/765237779ce4dbb60f4faf9ebc91386ce5218e15
  Author: Dave Lee <davelee.com at gmail.com>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    M lldb/source/Interpreter/CommandAlias.cpp
    M lldb/test/API/commands/command/nested_alias/TestNestedAlias.py

  Log Message:
  -----------
  [lldb] Prevent mutation of CommandAlias::GetOptionArguments

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

Differential Revision: https://reviews.llvm.org/D150078




More information about the All-commits mailing list