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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 5 13:35:03 PDT 2017


aaron.ballman added inline comments.


================
Comment at: clang-tidy/cert/CMakeLists.txt:8
   FloatLoopCounter.cpp
+  PostfixOperatorCheck.cpp
   LimitedRandomnessCheck.cpp
----------------
aaron.ballman wrote:
> Please keep the list of source files alphabetized.
This is still in the wrong position in the list.


================
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:
> 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?


https://reviews.llvm.org/D32743





More information about the cfe-commits mailing list