[clang] [llvm] Add macro to suppress -Wunnecessary-virtual-specifier (PR #139614)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 16:08:13 PDT 2025


================
@@ -710,4 +710,17 @@ 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.
+#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION()                            \
----------------
rnk wrote:

What version of clang introduced `-Wunnecessary-virtual-specifier`? Do we need to worry about warnings from old xcode clang?

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


More information about the llvm-commits mailing list