[clang-tools-extra] [clang-tidy] Add option to keep virtual in 'modernize-use-override' (PR #144916)

Frank Winklmeier via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 19 08:37:06 PDT 2025


================
@@ -226,7 +232,8 @@ void UseOverrideCheck::check(const MatchFinder::MatchResult &Result) {
         CharSourceRange::getTokenRange(OverrideLoc, OverrideLoc));
   }
 
-  if (HasVirtual) {
+  // Remove virtual unless requested otherwise
----------------
fwinkl wrote:

Note that even when `AllowVirtual` is used, the check does not add any missing `virtual` keywords. If this is preferred one could instead add a `UseVirtualAndOverride`  option which would then also add a missing `virtual` specifier.

https://github.com/llvm/llvm-project/pull/144916


More information about the cfe-commits mailing list