[llvm] f02e074 - Make sure `-Wnon-virtual-dtor` is passed only when compiling with Clang

Vlad Serebrennikov via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 07:46:54 PDT 2024


Author: Vlad Serebrennikov
Date: 2024-05-23T17:46:46+03:00
New Revision: f02e074552593435f97b97b81340014075f689e0

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

LOG: Make sure `-Wnon-virtual-dtor` is passed only when compiling with Clang

Another follow-up for #92953. Addresses buildbot failure https://lab.llvm.org/buildbot/#/builders/193/builds/52421

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index fa672b755dd69..99d848ba3d853 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -856,7 +856,9 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
   # The LLVM libraries have no stable C++ API, so -Wnoexcept-type is not useful.
   append("-Wno-noexcept-type" CMAKE_CXX_FLAGS)
 
-  append("-Wnon-virtual-dtor" CMAKE_CXX_FLAGS)
+  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+    append("-Wnon-virtual-dtor" CMAKE_CXX_FLAGS)
+  endif()
   append("-Wdelete-non-virtual-dtor" CMAKE_CXX_FLAGS)
 
   # Enable -Wsuggest-override if it's available, and only if it doesn't


        


More information about the llvm-commits mailing list