This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Add a hook to notify REPLs that an expression was evaluated
ClosedPublic

Authored by wallace on May 2 2023, 7:44 PM.

Details

Summary

REPL implementations don't have an easy way to know that an expression has been evaluated, so I'm adding a simple function for that. In the future we can add another hook for meta commands.

Diff Detail

Event Timeline

wallace created this revision.May 2 2023, 7:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2023, 7:44 PM
wallace requested review of this revision.May 2 2023, 7:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2023, 7:44 PM
bulbazord added inline comments.May 3 2023, 9:51 AM
lldb/include/lldb/Expression/REPL.h
115–120

Why not return a Status object instead of having the return type be void? Or instead of Status you could use llvm::Error so we are forced to check it.

wallace added inline comments.May 3 2023, 9:53 AM
lldb/include/lldb/Expression/REPL.h
115–120

my initial idea was to make this a simple observer, but a llvm::Error is probably more generic. I'll do that

wallace updated this revision to Diff 519163.May 3 2023, 10:42 AM

address comments

bulbazord added inline comments.May 4 2023, 10:32 AM
lldb/include/lldb/Expression/REPL.h
124

Do you still need the Status parameter?

wallace added inline comments.May 4 2023, 12:34 PM
lldb/include/lldb/Expression/REPL.h
124

that status is the result of the expression evaluation, so it's useful to have it here

bulbazord accepted this revision.May 4 2023, 12:35 PM
This revision is now accepted and ready to land.May 4 2023, 12:35 PM