This is an archive of the discontinued LLVM Phabricator instance.

[lldb] [DynamicRegisterInfo] Refactor SetRegisterInfo()
ClosedPublic

Authored by mgorny on Sep 28 2021, 3:09 AM.

Details

Summary

Move the "slice" and "composite" handling into separate methods to avoid
if/else hell. Use more LLVM types whenever possible. Replace printf()s
with llvm::Error combined with LLDB logging.

Diff Detail

Event Timeline

mgorny requested review of this revision.Sep 28 2021, 3:09 AM
mgorny created this revision.
mgorny added inline comments.
lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
244

clang-format seems to indent this weirdly.

labath accepted this revision.Sep 28 2021, 4:21 AM

wow

lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
244

I can't say I blame it. :)

Maybe make this a separate function too, so you can use ifs and returns ?

252–253

I think this would look better in the else branch below.

This revision is now accepted and ready to land.Sep 28 2021, 4:21 AM
mgorny marked 2 inline comments as done.Sep 28 2021, 7:36 AM
mgorny added inline comments.
lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
244

I didn't like this idea at first, then realized I can move the offset getter there too, and this makes everything even nicer.

This revision was automatically updated to reflect the committed changes.
mgorny marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2021, 7:48 AM