[all-commits] [llvm/llvm-project] d616a6: [lldb] Fix that the expression commands --top-leve...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Thu Apr 22 09:51:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d616a6bd107fcc0dc74f79e174e0b4fe27b26fe6
      https://github.com/llvm/llvm-project/commit/d616a6bd107fcc0dc74f79e174e0b4fe27b26fe6
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-04-22 (Thu, 22 Apr 2021)

  Changed paths:
    M lldb/source/Commands/CommandObjectExpression.cpp
    M lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py

  Log Message:
  -----------
  [lldb] Fix that the expression commands --top-level flag overwrites --allow-jit false

The `--allow-jit` flag allows the user to force the IR interpreter to run the
provided expression.

The `--top-level` flag parses and injects the code as if its in the top level
scope of a source file.

Both flags just change the ExecutionPolicy of the expression:
* `--allow-jit true` -> doesn't change anything (its the default)
* `--allow-jit false` -> ExecutionPolicyNever
* `--top-level` -> ExecutionPolicyTopLevel

Passing `--allow-jit false` and `--top-level` currently causes the `--top-level`
to silently overwrite the ExecutionPolicy value that was set by `--allow-jit
false`. There isn't any ExecutionPolicy value that says "top-level but only
interpret", so I would say we reject this combination of flags until someone
finds time to refactor top-level feature out of the ExecutionPolicy enum.

The SBExpressionOptions suffer from a similar symptom as `SetTopLevel` and
`SetAllowJIT` just silently disable each other. But those functions don't have
any error handling, so not a lot we can do about this in the meantime.

Reviewed By: labath, kastiglione

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




More information about the All-commits mailing list