[clang-tools-extra] [clang-tidy] Unsafe CRTP check (PR #82403)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 20 12:23:54 PST 2024


================
@@ -0,0 +1,167 @@
+//===--- UnsafeCrtpCheck.cpp - clang-tidy ---------------------------------===//
+//
+// 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 "UnsafeCrtpCheck.h"
+#include "../utils/LexerUtils.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::bugprone {
+
+namespace {
+// Finds a node if it's already a bound node.
+AST_MATCHER_P(CXXRecordDecl, isBoundNode, std::string, ID) {
----------------
PiotrZSL wrote:

you could do same with equalsBoundNode

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


More information about the cfe-commits mailing list