[llvm-branch-commits] [libcxx] [libc++] Clang-tidy operator& hijacker. (PR #128366)

Nikolas Klauser via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 12 10:44:03 PDT 2025


================
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 "clang-tidy/ClangTidyCheck.h"
+#include "clang-tidy/ClangTidyModuleRegistry.h"
+#include "clang/Tooling/FixIt.h"
+
+#include "robust_against_operator_ampersand.hpp"
+
+// This clang-tidy check ensures that we don't use operator& on dependant
+// types. If the type is user supplied it may call the type's operator&.
+// Instead use std::addressof.
----------------
philnik777 wrote:

This should go into the coding guidelines instead.

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


More information about the llvm-branch-commits mailing list