[Lldb-commits] [lldb] 388c9fb - Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories.

2020-07-22 Thread Logan Smith via lldb-commits

Author: Logan Smith
Date: 2020-07-22T14:19:34-07:00
New Revision: 388c9fb1af48b059d8b65cb2e002e0992d147aa5

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

LOG: Try enabling -Wsuggest-override again, using add_compile_options instead 
of add_compile_definitions for disabling it in unittests/ directories.

Using add_compile_definitions caused the flag to be passed to rc.exe on Windows 
and thus broke Windows builds.

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/unittests/CMakeLists.txt
clang/unittests/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/config-ix.cmake
flang/unittests/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
lld/unittests/CMakeLists.txt
lldb/unittests/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/CMakeLists.txt
llvm/utils/benchmark/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
mlir/unittests/CMakeLists.txt
parallel-libs/acxxel/CMakeLists.txt
polly/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index c25e2b7f8103..b4514e95c9e5 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -22,6 +22,10 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 if (CLANGD_ENABLE_REMOTE)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)

diff  --git a/clang-tools-extra/unittests/CMakeLists.txt 
b/clang-tools-extra/unittests/CMakeLists.txt
index 086a68e63830..72abe0fa6d0c 100644
--- a/clang-tools-extra/unittests/CMakeLists.txt
+++ b/clang-tools-extra/unittests/CMakeLists.txt
@@ -5,6 +5,10 @@ function(add_extra_unittest test_dirname)
   add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 add_subdirectory(clang-apply-replacements)
 add_subdirectory(clang-change-namespace)
 add_subdirectory(clang-doc)

diff  --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index 4c222e24599f..f156372cbc4f 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -10,6 +10,10 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 # add_clang_unittest(test_dirname file1.cpp file2.cpp)
 #
 # Will compile the list of files together and link against the clang

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index dab55707338a..efb660818270 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -403,6 +403,7 @@ set(COMPILER_RT_GMOCK_CFLAGS
 
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 
COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG 
-Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
+append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override 
COMPILER_RT_UNITTEST_CFLAGS)
 
 if(MSVC)
   # gtest use a lot of stuff marked as deprecated on Windows.

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index f535123351d6..0a27910ed494 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -106,6 +106,7 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor"   
COMPILER_RT_HAS_WNON_VIRT
 check_cxx_compiler_flag("-Werror -Wvariadic-macros"
COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
 check_cxx_compiler_flag("-Werror -Wunused-parameter"   
COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag("-Werror -Wcovered-switch-default" 
COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
+check_cxx_compiler_flag("-Werror -Wsuggest-override"   
COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
 check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
 
 check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)

diff  --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index d53d155f2f2b..21da59f3afcb 100644
--- a/flang/unittests/CMakeLists.txt
+++ b/flang/unittests/CMakeLists.txt
@@ -5,6 +5,10 @@ function(add_flang_unittest test_dirname)
   add_unittest(FlangUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 add_subdi

[Lldb-commits] [lldb] 77e0e9e - Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."

2020-07-22 Thread Logan Smith via lldb-commits

Author: Logan Smith
Date: 2020-07-22T17:50:19-07:00
New Revision: 77e0e9e17daf0865620abcd41f692ab0642367c4

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

LOG: Reapply "Try enabling -Wsuggest-override again, using add_compile_options 
instead of add_compile_definitions for disabling it in unittests/ directories."

add_compile_options is more sensitive to its location in the file than 
add_definitions--it only takes effect for sources that are added after it. This 
updated patch ensures that the add_compile_options is done before adding any 
source files that depend on it.

Using add_definitions caused the flag to be passed to rc.exe on Windows and 
thus broke Windows builds.

Added: 


Modified: 
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/unittests/CMakeLists.txt
clang/unittests/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/config-ix.cmake
flang/unittests/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
lld/unittests/CMakeLists.txt
lldb/unittests/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/CMakeLists.txt
llvm/utils/benchmark/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
mlir/unittests/CMakeLists.txt
parallel-libs/acxxel/CMakeLists.txt
polly/unittests/CMakeLists.txt

Removed: 




diff  --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt 
b/clang-tools-extra/clangd/unittests/CMakeLists.txt
index c25e2b7f8103..8ede92c16f7a 100644
--- a/clang-tools-extra/clangd/unittests/CMakeLists.txt
+++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt
@@ -13,6 +13,10 @@ include_directories(
   ${CLANGD_BINARY_DIR}
   )
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 if(CLANG_BUILT_STANDALONE)
   # LLVMTestingSupport library is needed for clangd tests.
   if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support

diff  --git a/clang-tools-extra/unittests/CMakeLists.txt 
b/clang-tools-extra/unittests/CMakeLists.txt
index 086a68e63830..72abe0fa6d0c 100644
--- a/clang-tools-extra/unittests/CMakeLists.txt
+++ b/clang-tools-extra/unittests/CMakeLists.txt
@@ -5,6 +5,10 @@ function(add_extra_unittest test_dirname)
   add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 add_subdirectory(clang-apply-replacements)
 add_subdirectory(clang-change-namespace)
 add_subdirectory(clang-doc)

diff  --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index 4c222e24599f..9a52b9fb0262 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -1,6 +1,10 @@
 add_custom_target(ClangUnitTests)
 set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests")
 
+if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
+  add_compile_options("-Wno-suggest-override")
+endif()
+
 if(CLANG_BUILT_STANDALONE)
   # LLVMTestingSupport library is needed for some of the unittests.
   if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support

diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index dab55707338a..efb660818270 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -403,6 +403,7 @@ set(COMPILER_RT_GMOCK_CFLAGS
 
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 
COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG 
-Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
+append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override 
COMPILER_RT_UNITTEST_CFLAGS)
 
 if(MSVC)
   # gtest use a lot of stuff marked as deprecated on Windows.

diff  --git a/compiler-rt/cmake/config-ix.cmake 
b/compiler-rt/cmake/config-ix.cmake
index f535123351d6..0a27910ed494 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -106,6 +106,7 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor"   
COMPILER_RT_HAS_WNON_VIRT
 check_cxx_compiler_flag("-Werror -Wvariadic-macros"
COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
 check_cxx_compiler_flag("-Werror -Wunused-parameter"   
COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag("-Werror -Wcovered-switch-default" 
COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
+check_cxx_compiler_flag("-Werror -Wsuggest-override"   
COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
 check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
 
 check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)

diff  --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt
index d

[Lldb-commits] [lldb] 44b43a5 - [lldb][NFC] Add 'override' where missing in source/ and tools/

2020-07-15 Thread Logan Smith via lldb-commits

Author: Logan Smith
Date: 2020-07-15T11:34:47-07:00
New Revision: 44b43a52dc17135e43824e826862c8b35081cac0

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

LOG: [lldb][NFC] Add 'override' where missing in source/ and tools/

These were found by Clang's new -Wsuggest-override.

This patch doesn't touch any code in unittests/, since much of it intentionally 
doesn't use override to avoid massive warning spam from 
-Winconsistent-missing-override due to the use of MOCK_*** macros.

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

Added: 


Modified: 
lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_i386.h
lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_x86_64.h
lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
lldb/source/Plugins/Process/Utility/RegisterContextMach_arm.h
lldb/source/Plugins/Process/Utility/RegisterContextMach_i386.h
lldb/source/Plugins/Process/Utility/RegisterContextMach_x86_64.h
lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h
lldb/source/Symbol/FuncUnwinders.cpp
lldb/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
lldb/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h

Removed: 




diff  --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp 
b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 2f4a8917a78a..dde25184a8c5 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -873,7 +873,7 @@ class CommandObjectProcessKDPPacketSend : public 
CommandObjectParsed {
   OptionGroupUInt64 m_command_byte;
   OptionGroupString m_packet_data;
 
-  virtual Options *GetOptions() { return &m_option_group; }
+  Options *GetOptions() override { return &m_option_group; }
 
 public:
   CommandObjectProcessKDPPacketSend(CommandInterpreter &interpreter)
@@ -900,7 +900,7 @@ class CommandObjectProcessKDPPacketSend : public 
CommandObjectParsed {
 
   ~CommandObjectProcessKDPPacketSend() {}
 
-  bool DoExecute(Args &command, CommandReturnObject &result) {
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
 const size_t argc = command.GetArgumentCount();
 if (argc == 0) {
   if (!m_command_byte.GetOptionValue().OptionWasSet()) {

diff  --git 
a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h 
b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
index 616aff8afda7..35ae0d03e2bb 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm.h
@@ -20,21 +20,21 @@ class RegisterContextKDP_arm : public 
RegisterContextDarwin_arm {
   virtual ~RegisterContextKDP_arm();
 
 protected:
-  virtual int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr);
+  int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) override;
 
-  int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu);
+  int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu) override;
 
-  int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc);
+  int DoReadEXC(lldb::tid_t tid, int flavor, EXC &exc) override;
 
-  int DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg);
+  int DoReadDBG(lldb::tid_t tid, int flavor, DBG &dbg) override;
 
-  int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr);
+  int DoWriteGPR(lldb::tid_t tid, int flavor, const GPR &gpr) override;
 
-  int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu);
+  int DoWriteFPU(lldb::tid_t tid, int flavor, const FPU &fpu) override;
 
-  int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc);
+  int DoWriteEXC(lldb::tid_t tid, int flavor, const EXC &exc) override;
 
-  int DoWriteDBG(lldb::tid_t tid, int flavor, const DBG &dbg);
+  int DoWriteDBG(lldb::tid_t tid, int flavor, const DBG &dbg) override;
 
   ThreadKDP &m_kdp_thread;
 };

diff  --git 
a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h 
b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
index 998a78a6b8af..be387d69c6bc 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/RegisterContextKDP_arm64.h
@@ -21,21 +21,21 @@ class RegisterContextKDP_arm64 : public 
RegisterContextDarwin_arm64 {
   virtual ~RegisterContextKDP_arm64();
 
 protected:
-  virtual int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr);
+  int DoReadGPR(lldb::tid_t tid, int flavor, GPR &gpr) override;
 
-  int DoReadFPU(lldb::tid_t tid, int flavor, FPU &fpu);
+  int