[clang] [clang-tools-extra] [clang-tidy][use-internal-linkage]fix false positives for global overloaded operator new and operator delete (PR #117945)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 28 03:36:45 PST 2024
================
@@ -85,3 +85,13 @@ void func_with_body() {}
void func_without_body();
void func_without_body();
}
+
+// gh117489 start
+namespace std {
+using size_t = decltype(sizeof(int));
+}
+void * operator new(std::size_t);
+void * operator new[](std::size_t);
+void operator delete(void*);
+void operator delete[](void*);
+// gh117489 end
----------------
5chmidti wrote:
In the previous PR, you constrained the matcher to require that a body is available, so this test would pass, even without the change in this PR.
*Unless* you have checked that this was broken before, because the implicitly generated operators are considered to be the body of these declarations. Though, adding the body would mean there is less confusion/need for a comment.
Please also mark the delete functions `noexcept`
https://github.com/llvm/llvm-project/pull/117945
More information about the cfe-commits
mailing list