This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by teemperor on Nov 19 2020, 3:53 AM.

Details

Summary

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.

Diff Detail

Event Timeline

teemperor requested review of this revision.Nov 19 2020, 3:53 AM
teemperor created this revision.
labath accepted this revision.Nov 19 2020, 3:59 AM

seems reasonable

This revision is now accepted and ready to land.Nov 19 2020, 3:59 AM

But those functions don't have any error handling, so not a lot we can do about this in the meantime.

Could they throw an exception? Or log a warning?

kastiglione accepted this revision.Nov 19 2020, 12:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2021, 9:51 AM