A recent series of commits have added the infrastructure to support top-level expressions in LLDB; this patch exposes and tests the functionality.
It is exposed via a new argument to expression, -p / --top-level. When this command is provided, the expression is compiled and injected into the process via the JIT, and the resultant declarations and types are stored. However, only static initializers are run; there is no concept of a top-level expression. The intent is that later code can use the variables, functions, and classes defined by these expressions.
I've also added a testcase that verifies that top-level code acts exactly the same way as if it were written in a source file. Complicated inline functions are also included. This testcase requires a clang patch (fixing some missing cases in ASTImporter) to work correctly, but it should give you an idea of what I expect to work.
Please make b a more descriptive name, and perhaps add documentation for these methods.