[clang] [llvm] Reland "Add macro to suppress -Wunnecessary-virtual-specifier" (PR #141091)
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Wed May 28 11:01:26 PDT 2025
================
@@ -710,4 +710,28 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
#define LLVM_PREFERRED_TYPE(T)
#endif
+/// \macro LLVM_VIRTUAL_ANCHOR_FUNCTION
+/// This macro is used to adhere to LLVM's policy that each class with a vtable
+/// must have at least one out-of-line virtual function. This macro allows us
+/// to declare such a function in `final` classes without triggering a warning.
+// clang-format off
+// Autoformatting makes this look awful.
+#if defined(__clang__)
+ // Make sure this is only parsed if __clang__ is defined
----------------
nico wrote:
(I think some clangs on some bots don't have `__has_warning`; I ran into that recently too: https://github.com/llvm/llvm-project/commit/c2a62af2a51d58183bcd72ee8a86c37ddd526758 I'll push a similar commit for this.)
https://github.com/llvm/llvm-project/pull/141091
More information about the cfe-commits
mailing list