Fix for clang-tidy to allow using -list-checks without positional parameters


This is a trivial fix, but I just wanted to start working with clang tooling and figured this was a good way to get my feet wet.

I’ve attached two patch files, one for clang::tooling::CommonOptionsParser which adds a new ctor taking an cl::NumOccurrences parameter for the SourcePaths option. It defaults to current behavior, so users don’t need to make any changes.

The second patch is for clangTidyMain. It just adds a dummy file if pathlist is empty, and maintains all current logic.


tooling.diff (2.75 KB)

clang-tidy.diff (1.16 KB)


Thank you for the patches! I find it more convenient to review patches via Phabricator. If you don’t mind, could you upload them as described here, put me to reviewers: and cfe-commits to subscribers? I’ll take a look at the patches early next week.


P.S. In any case, the right list for patches is cfe-commits rather than cfe-dev, and it usually makes sense to add at least one specific reviewer (e.g. someone who recently was making changes to the files the patch touches).


Hi Alex:

Great, thanks. I just setup phabricator and arcanist on my mac, so I’ll build against the latest and push my diff later today.

Btw, since the patches are for 2 separate repos, clang and clang-extra, is there something special I need to do to indicate that relationship, i.e., the clang-extra diff depends on the clang diff.

thanks again…