[PATCH] D53025: [clang-tidy] implement new check for const return types.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 30 13:47:18 PDT 2018


aaron.ballman added a comment.

I think this is getting really close! One question: would it make more sense to name this `readability-const-type-return` or `readability-const-return-type` instead? It's not that the functions return a const *value* that's the issue, it's that the declared return type is top-level const. I think removing "value" and using "type" instead would be an improvement (and similarly, rename the files and the check).



================
Comment at: clang-tidy/readability/ConstValueReturnCheck.cpp:111
+    DiagnosticBuilder Diagnostic =
+        diag(Def->getInnerLocStart(),
+             "return type %0 is 'const'-qualified at the top level, which may "
----------------
I think you want `getBeginLoc()` here instead.


================
Comment at: docs/clang-tidy/checks/readability-const-value-return.rst:4
+readability-const-value-return
+===================================
+
----------------
Underlining here is incorrect.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53025





More information about the cfe-commits mailing list