[PATCH] D116439: [clang-tidy] Fix `readability-const-return-type` for pure virtual function.

liushuai wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 7 02:06:23 PST 2022


MTC added subscribers: flx, MTC.
MTC added a comment.

FYI: I'm from Bytedance Inc <https://www.bytedance.com/en/>, @Sockke, and I are fixing the AutoFix bugs recently, most of them will lead to the compilation error.  For this bug, fixing the override virtual methods but missing the pure virtual base method, which will cause the compilation error. These annoying bugs will hinder the large-scale deployment of clang-tidy AutoFix in the production environment.



================
Comment at: clang-tools-extra/clang-tidy/readability/ConstReturnTypeCheck.cpp:101
+      functionDecl(returns(isConstQualified()),
+                   anyOf(isDefinition(), cxxMethodDecl(isPure())))
+          .bind("func"),
----------------
Like @flx comments in https://reviews.llvm.org/D116593, the better choice is that we suppress the fix for the virtual method. What do you think @Sockke?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116439/new/

https://reviews.llvm.org/D116439



More information about the cfe-commits mailing list