[PATCH] Add readability-remove-void-arg check to clang-tidy

David Blaikie dblaikie at gmail.com
Tue Mar 3 07:22:55 PST 2015


On Mar 3, 2015 7:20 AM, "Alexander Kornienko" <alexfh at google.com> wrote:
>
> ================
> Comment at: clang-tidy/readability/RedundantVoidArg.cpp:41
> @@ +40,3 @@
> +bool protoTypeHasNoParms(QualType QT) {
> +  if (const auto PT = QT->getAs<PointerType>()) {
> +    QT = PT->getPointeeType();
> ----------------
> Please use either "auto" or "const auto *" consistently. This function
has usages of both.

Generally, if your type is a pointer, please put the * on it explicitly
(same for const) - if the llvm style guide doesn't already recommend this,
it should.

>
> ================
> Comment at: clang-tidy/readability/RemoveVoidArg.h:38
> @@ +37,3 @@
> +private:
> +  bool CPlusPlusFile_;
> +
> ----------------
> LegalizeAdulthood wrote:
> > alexfh wrote:
> > > 1. You don't need to store this flag as it's easy and cheap to check
it on each call to `check()`: it's available as
`Result.Context->getLangOpts().CPlusPlus`.
> > > 2. This name violates LLVM Naming conventions:
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
> > Thanks for showing me where I could get that option.  I drilled around
in the code for a while and couldn't find it except hanging off the
Compiler.  What would be really nice is if I could get ahold of that flag
when I'm asked to add matchers as I could simply not add any matchers in
that case, but `registerPPCallbacks` is called after `registerMatchers`.
Can I navigate to it from `ClangTidyContext`?
> Language options only become available when a compiler instance is being
initialized. The matchers are registered way before that and then multiple
different compilations may be run potentially with different options (if
multiple translation units have been passed to clang-tidy).
>
> So there's no way to learn what language will be analyzed when we
register matchers.
>
> http://reviews.llvm.org/D7639
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150303/6abb74bd/attachment.html>


More information about the cfe-commits mailing list