[clang-tools-extra] [clang-tidy] Detect std::rot[lr] pattern within modernize.use-std-bit (PR #186324)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 13 03:07:47 PDT 2026


================
@@ -141,6 +154,48 @@ void UseStdBitCheck::check(const MatchFinder::MatchResult &Result) {
            << IncludeInserter.createIncludeInsertion(
                   Source.getFileID(MatchedExpr->getBeginLoc()), "<bit>");
     }
+  } else if (const auto *MatchedExpr =
+                 Result.Nodes.getNodeAs<BinaryOperator>("rotate_expr")) {
+    const auto *MatchedVarDecl = Result.Nodes.getNodeAs<VarDecl>("v");
----------------
vbvictor wrote:

`UseStdBitCheck::check` is getting rather big with more and more cases.
Would be highly appreciated if we split processing of each match into separate functions, like `handleRotate()`, `handlePopcount()`, etc... (can be a separate PR)

Many checks should already follow this pattern, grep by `handle*` 

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


More information about the cfe-commits mailing list