[clang-tools-extra] [clang-tidy] Add `modernize-use-bit-cast` check (PR #189962)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 1 09:09:59 PDT 2026
================
@@ -0,0 +1,305 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "UseBitCastCheck.h"
+#include "../utils/Matchers.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/AST/Expr.h"
+#include "clang/AST/ExprCXX.h"
+#include "clang/AST/Type.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+#include "llvm/ADT/STLExtras.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::modernize {
+
+static const Expr *stripMemcpyArgument(const Expr *ExprNode) {
+ ExprNode = ExprNode->IgnoreParenImpCasts();
+ while (const auto *Cast = dyn_cast<ExplicitCastExpr>(ExprNode))
----------------
serge-sans-paille wrote:
Looks like [IgnoreParenCasts](https://clang.llvm.org/doxygen/classclang_1_1Expr.html#a397a707d10e0d3ac4a150325eafa4368)
https://github.com/llvm/llvm-project/pull/189962
More information about the cfe-commits
mailing list