This is an archive of the discontinued LLVM Phabricator instance.

Change PathMappingList::RemapPath to return an optional result (NFC)
ClosedPublic

Authored by aprantl on Jun 16 2021, 11:30 AM.

Details

Summary

This is an NFC modernization refactoring that replaces the combination of a bool return + reference argument, with an Optional return value.

Diff Detail

Event Timeline

aprantl requested review of this revision.Jun 16 2021, 11:30 AM
aprantl created this revision.
shafik added inline comments.Jun 21 2021, 11:51 AM
lldb/source/Core/Module.cpp
1604

Why not also have this return an Optional?

aprantl added inline comments.Jun 22 2021, 9:21 AM
lldb/source/Core/Module.cpp
1604

That would be perfectly reasonable. I'll add a review for that patch.

jingham accepted this revision.Jun 25 2021, 9:36 AM

LGTM.

If the return type of the new function is not too awful to type, maybe don't use auto? It says it's returning a path, which is usually a string, not a FileSpec... But that's more a matter of taste.

lldb/source/Core/Module.cpp
1607–1611

RemapPath doesn't make it obvious you are getting a FileSpec back. Is the actual return something awful to type?

This revision is now accepted and ready to land.Jun 25 2021, 9:36 AM

if the return type of the new function is not too awful to type, maybe don't use auto? It says it's returning a path, which is usually a string, not a FileSpec... But that's more a matter of taste.

I think that's generally advice. In this particular case, the code gets deleted by a subsequent patch in this stack anyway.

This revision was landed with ongoing or failed builds.Jun 25 2021, 2:15 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 25 2021, 2:15 PM