[PATCH] D32743: [clang-tidy] Add new cert-dcl21-cpp check.

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 7 03:41:16 PDT 2017


xazax.hun added inline comments.


================
Comment at: clang-tidy/cert/PostfixOperatorCheck.cpp:72
+
+  diag(Location, "return type of overloaded %0 is not a constant type")
+      << FuncDecl << FixItHint::CreateInsertion(Location, "const ");
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > JonasToth wrote:
> > > for clarity, this could be an else path to the if in line 69.
> > > The if could check on the negation as well, and fix only in that case. (kinda swap the logic). I think that would be clearer.
> > Instead of using "constant type", I would use "constant object type", and reword it to be more similar to the previous diagnostic. In fact, you could even combine the two diagnostics into one with a %select, because this diagnostic should also receive the same fixit as the above one.
> > ```
> > "overloaded %0 returns a %select{reference|non-constant object}1, instead of a constant object type"
> > ```
> Is there a reason you didn't combine the two diagnostics?
Since the fixits are also different for the two cases, I think it is cleaner to keep the diag separate. 


https://reviews.llvm.org/D32743





More information about the cfe-commits mailing list