================
@@ -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.
----------------
ldionne wrote:

I agree with @mordante here, this is documented explicitly in the coding 
guidelines already:

> Function overloading also applies to operators. Using &user_object may call a 
> user-defined operator&. Use std::addressof instead. Similarly, to avoid 
> invoking a user-defined operator,, make sure to cast the result to void when 
> using the , or avoid it in the first place. For example:

IMO this comment doesn't provide absolutely necessary information, but it also 
doesn't hurt. I'd keep it.

https://github.com/llvm/llvm-project/pull/128366
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to