This is an archive of the discontinued LLVM Phabricator instance.

Refactor GlobList from an ad-hoc linked list to a vector
ClosedPublic

Authored by gribozavr on Aug 27 2019, 1:27 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

gribozavr created this revision.Aug 27 2019, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2019, 1:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ilya-biryukov accepted this revision.Aug 27 2019, 1:32 AM

LGTM

clang-tools-extra/clang-tidy/GlobList.cpp
46 ↗(On Diff #217322)

NIT: I suggest using for (;!Globs.empty();) {} to make the stop condition stand out more.
Not a big deal, though, feel free to keep as is

This revision is now accepted and ready to land.Aug 27 2019, 1:32 AM
gribozavr marked an inline comment as done.Aug 27 2019, 4:00 AM
gribozavr added inline comments.
clang-tools-extra/clang-tidy/GlobList.cpp
46 ↗(On Diff #217322)

It is actually important for the algorithm to use a do-while loop... The linked-list-based code always parsed at least one glob, even if the input string is empty. Therefore, new loop-based code should also parse at least one glob.

I added a doc comment:

+  /// An empty \p Globs string is interpreted as one glob that matches an empty
+  /// string.
   GlobList(StringRef Globs);

Please let me know if that is not sufficient. There are also tests for this behavior.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2019, 4:05 AM