Page MenuHomePhabricator

[Target] Introduce Process::GetLanguageRuntimes
ClosedPublic

Authored by xiaobai on May 28 2019, 5:22 PM.

Details

Summary

Currently there's not really a good way to iterate over the language runtimes a
process has. This is sometimes desirable (as seen in my change to Thread).
Additionally, there's not really a good reason to iterate over every available
language, but rather only over languages for which we have a plugin loaded.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

xiaobai created this revision.May 28 2019, 5:22 PM
JDevlieghere added inline comments.May 28 2019, 8:36 PM
source/Target/Thread.cpp
2216

if for (LanguageRuntime *runtime : GetProcess()->GetLanguageRuntimes()) { fits on one line I would get rid of the temporary.

labath added a subscriber: labath.May 29 2019, 1:39 AM
labath added inline comments.
source/Target/Process.cpp
1565

Use auto * to make it clear that this is a pointer (or even LanguageRuntime *, as the type is not that long). Then drop std::move below, as it's useless for pointers.

source/Target/Thread.cpp
2217–2218

It looks like the code already makes sure null pointers don't make it into the list. We should make that a part of the contract and not check it twice.

xiaobai updated this revision to Diff 201959.May 29 2019, 9:20 AM

Address review feedback

xiaobai marked 3 inline comments as done.May 29 2019, 9:21 AM
This revision is now accepted and ready to land.May 29 2019, 10:44 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2019, 11:05 AM