[libcxx-commits] [libcxx] 55cb62f - [libc++] Enable -Wweak-vtables

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 18 08:27:46 PDT 2022


Author: Nikolas Klauser
Date: 2022-06-18T17:27:33+02:00
New Revision: 55cb62f34a6f60db84c629d2693b7a2f204eecdc

URL: https://github.com/llvm/llvm-project/commit/55cb62f34a6f60db84c629d2693b7a2f204eecdc
DIFF: https://github.com/llvm/llvm-project/commit/55cb62f34a6f60db84c629d2693b7a2f204eecdc.diff

LOG: [libc++] Enable -Wweak-vtables

This makes Clang scream at us if there is a class without a key function.

Reviewed By: ldionne, #libc

Spies: libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D127900

Added: 
    

Modified: 
    libcxx/include/__functional/function.h
    libcxx/test/libcxx/clang_tidy.sh.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 5e734d0af350c..3f894985702e1 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -35,6 +35,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 // bad_function_call
 
+_LIBCPP_DIAGNOSTIC_PUSH
+_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables")
 class _LIBCPP_EXCEPTION_ABI bad_function_call
     : public exception
 {
@@ -52,6 +54,7 @@ class _LIBCPP_EXCEPTION_ABI bad_function_call
     virtual const char* what() const _NOEXCEPT;
 #endif
 };
+_LIBCPP_DIAGNOSTIC_POP
 
 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
 void __throw_bad_function_call()

diff  --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp
index d3cae11d864cf..a62eeef0c680f 100644
--- a/libcxx/test/libcxx/clang_tidy.sh.cpp
+++ b/libcxx/test/libcxx/clang_tidy.sh.cpp
@@ -9,7 +9,7 @@
 // REQUIRES: has-clang-tidy
 // XFAIL: modules-build
 
-// RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* -- -Wno-unknown-warning-option %{compile_flags}
+// RUN: clang-tidy %s --warnings-as-errors=* -header-filter=.* -- -Wweak-vtables -Wno-unknown-warning-option %{compile_flags}
 // -Wno-unknown-warning-option tells clang-tidy to ignore '-W' command-line arguments that it doesn't know.
 // There are some GCC-specific ones where clang-tidy would warn otherwise.
 


        


More information about the libcxx-commits mailing list