This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Lift parsing of sequence of names functions to utils.
ClosedPublic

Authored by etienneb on May 2 2016, 6:24 PM.

Details

Summary

Lift some common code used by multiple checkers.

This function is also used by checkers that are coming.
It is quite common for a checker to parse a list of names.

Diff Detail

Event Timeline

etienneb updated this revision to Diff 55929.May 2 2016, 6:24 PM
etienneb retitled this revision from to [clang-tidy] Lift parsing of sequence of names functions to utils..
etienneb updated this object.
etienneb added a reviewer: alexfh.
etienneb added a subscriber: cfe-commits.
alexfh requested changes to this revision.May 3 2016, 1:47 AM
alexfh edited edge metadata.
alexfh added inline comments.
clang-tidy/misc/SuspiciousStringCompareCheck.cpp
97

Please add a comment that the KnownStringCompareFunctions string should end with a semicolon.

clang-tidy/utils/OptionUtils.h
18 ↗(On Diff #55929)

"options" would convey the idea slightly better, imo.

21 ↗(On Diff #55929)

I don't think this code is specific to "names". Maybe parseStrings, parseList or parseSemicolonSeparatedList?

23 ↗(On Diff #55929)
  1. s/parse/parsed/
  2. Please enclose parseName in backquotes.
  3. It's more common to use ArrayRef from llvm/ADT/ArrayRef.h to pass a reference to a number of sequential elements.
This revision now requires changes to proceed.May 3 2016, 1:47 AM
etienneb updated this revision to Diff 56173.May 4 2016, 10:44 AM
etienneb edited edge metadata.
etienneb marked 4 inline comments as done.

address alexfh comments

alexfh accepted this revision.May 10 2016, 6:52 AM
alexfh edited edge metadata.

Looks good with one nit. Thank you!

clang-tidy/utils/OptionsUtils.h
22

On the second thought, parseStrings is too vague. Maybe makes sense to rename to parseStringList (and serializeStringList).

This revision is now accepted and ready to land.May 10 2016, 6:52 AM
etienneb updated this revision to Diff 56723.May 10 2016, 8:34 AM
etienneb edited edge metadata.

fix alexfh comments (renaming)

etienneb marked an inline comment as done.May 10 2016, 8:36 AM

renaming done, landing.

etienneb closed this revision.May 10 2016, 8:37 AM