[cfe-dev] [clang-tidy] multiple declaration statement check contribution

Kirill Bobyrev via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 24 08:47:10 PDT 2016


Hi Firat,

Sure, go ahead!

Unfortunately, I don’t have much time at the moment.

I would suggest to enhance CppCoreGuidelines rule too: I think it’s currently not restrictive and precise enough. I’ve opened an Issue [0] on Github; sadly, there’s no feedback yet.

—
Kirill

[0] https://github.com/isocpp/CppCoreGuidelines/issues/770 <https://github.com/isocpp/CppCoreGuidelines/issues/770>

> On 24 Oct 2016, at 14:41, Firat Kasmis <firat.kasmis at gmail.com> wrote:
> 
> As far as I can see, the check does not include any FixItHint yet that I have already implemented for most of the cases. Kirill is it OK for you, if I keep continuing this and provide a patch? 
> 
> Regarding differences between CERT and CppCore: 
> How about providing a general readability-checker that splits up any init-declarator list into single init-declarators? Then, we may provide "pseudo" cert-one-name-per-declaration and cppcore-one-name-per-declaration checks which will register the general readability checker and use Options to pass the config paramer (cert and cppcore) to the general check. 
> 
> Something like:
> 
> // ReadabilityTidyModule.cpp
> CheckFactories.registerCheck<OneNamePerDeclarationCheck>("readability-one-name-per-declaration");
> 
> // CERTTidyModule.cpp
> CheckFactories.registerCheck<readability::OneNamePerDeclarationCheck>("cert-one-name-per-declaration");
> 
> ClangTidyOptions getModuleOptions() override {
>     ClangTidyOptions Options;
>     auto &Opts = Options.CheckOptions;
>     Opts["cert-one-name-per-declaration.style"] = "cert";
>     return Options;
> }
> 
> // CppCoreGuidelinesModule.cpp
> CheckFactories.registerCheck<readability::OneNamePerDeclarationCheck>("cppcoreguidelines-one-name-per-declaration");
> 
> ClangTidyOptions getModuleOptions() override {
>     ClangTidyOptions Options;
>     auto &Opts = Options.CheckOptions;
>     Opts["cert-one-name-per-declaration.style"] = "ccpcore";
>     return Options;
> }
> 
> Any thoughts on this?
> 
> 
> 
> 2016-10-21 17:18 GMT+02:00 Malcolm Parsons <malcolm.parsons at gmail.com <mailto:malcolm.parsons at gmail.com>>:
> On 21 October 2016 at 16:06, Firat Kasmis via cfe-dev
> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
> > I would like to know if there is any need for a readability check that
> > checks for multiple declarations in one statement (init-declarator list.
> 
> Kirill Bobyrev is working on one.
> See https://reviews.llvm.org/D25024 <https://reviews.llvm.org/D25024>
> 
> --
> Malcolm Parsons
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161024/bbf4a58e/attachment.html>


More information about the cfe-dev mailing list