[Lldb-commits] [lldb] r350209 - NativeProcessProtocolTest: fix -Winconsistent-missing-override warning

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 2 02:37:38 PST 2019

Author: labath
Date: Wed Jan  2 02:37:38 2019
New Revision: 350209

URL: http://llvm.org/viewvc/llvm-project?rev=350209&view=rev
NativeProcessProtocolTest: fix -Winconsistent-missing-override warning

The warning comes from the fact that the MOCK_METHOD macros don't use the
override keyword internally. This makes us not use it in the manually overriden
methods either, to be consistent.


Modified: lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp?rev=350209&r1=350208&r2=350209&view=diff
--- lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp (original)
+++ lldb/trunk/unittests/Host/NativeProcessProtocolTest.cpp Wed Jan  2 02:37:38 2019
@@ -24,6 +24,9 @@ public:
   MOCK_METHOD1(DidExec, void(NativeProcessProtocol *Process));
+// NB: This class doesn't use the override keyword to avoid
+// -Winconsistent-missing-override warnings from the compiler. The
+// inconsistency comes from the overriding definitions in the MOCK_*** macros.
 class MockProcess : public NativeProcessProtocol {
   MockProcess(NativeDelegate &Delegate, const ArchSpec &Arch,
@@ -47,9 +50,9 @@ public:
                Status(const llvm::StringRef &FileName, addr_t &Addr));
-  const ArchSpec &GetArchitecture() const override { return Arch; }
+  const ArchSpec &GetArchitecture() const /*override*/ { return Arch; }
   Status SetBreakpoint(lldb::addr_t Addr, uint32_t Size,
-                       bool Hardware) override {
+                       bool Hardware) /*override*/ {
     if (Hardware)
       return SetHardwareBreakpoint(Addr, Size);
@@ -59,9 +62,9 @@ public:
   // Redirect base class Read/Write Memory methods to functions whose signatures
   // are more mock-friendly.
   Status ReadMemory(addr_t Addr, void *Buf, size_t Size,
-                    size_t &BytesRead) override;
+                    size_t &BytesRead) /*override*/;
   Status WriteMemory(addr_t Addr, const void *Buf, size_t Size,
-                     size_t &BytesWritten) override;
+                     size_t &BytesWritten) /*override*/;
                llvm::Expected<std::vector<uint8_t>>(addr_t Addr, size_t Size));

More information about the lldb-commits mailing list