This is an archive of the discontinued LLVM Phabricator instance.

[lldb] NFC: less nesting in SearchFilter.cpp
ClosedPublic

Authored by kwk on Dec 4 2019, 8:34 AM.

Details

Summary

I was working on SearchFilter.cpp and felt it a bit too complex in some cases in terms of nesting and logic flow.

Event Timeline

kwk created this revision.Dec 4 2019, 8:34 AM
Herald added a project: Restricted Project. · View Herald Transcript
kwk edited the summary of this revision. (Show Details)Dec 4 2019, 8:36 AM
JDevlieghere accepted this revision.Dec 4 2019, 9:41 AM
JDevlieghere added a subscriber: JDevlieghere.
JDevlieghere added inline comments.
lldb/source/Core/SearchFilter.cpp
625

I'd move this down and use

if (!success)
  return std::make_shared<SearchFilterByModuleList>(target.shared_from_this(),{});

to make it clear the list of modules is empty.

This revision is now accepted and ready to land.Dec 4 2019, 9:41 AM
teemperor accepted this revision.Dec 4 2019, 11:42 AM
teemperor added a subscriber: teemperor.

I have one minor request (see inline comments), but otherwise LGTM, thanks!

lldb/source/Core/SearchFilter.cpp
777

Simplify with de Morgan (or maybe we could get rid of the no_modules_in_filter as this just seems to be an "optimization" to avoid the FindFileIndex function call, but just getting rid of the !(...) is fine).

kwk updated this revision to Diff 232494.Dec 5 2019, 11:04 PM
  • Review comments
kwk requested review of this revision.Dec 5 2019, 11:05 PM
kwk marked 2 inline comments as done.

Addressed all review comments.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 5 2019, 11:40 PM
This revision was automatically updated to reflect the committed changes.