[clang-tools-extra] [clang-tidy] New checker: modernize.use-std-bit to detect std::has_one_bit idiom (PR #185435)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 10:31:47 PDT 2026


================
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "UseStdBitCheck.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::modernize {
+
+void UseStdBitCheck::registerMatchers(MatchFinder *Finder) {
+  const auto MakeBinaryOperatorMatcher = [](auto Op) {
----------------
zwuis wrote:

Write `StringRef`. Ditto elsewhere.

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


More information about the cfe-commits mailing list