Skip to content
Permalink
Browse files

Common/DebugInterface: Use forward declarations where applicable

We're allowed (by the standard) to forward declare types within
std::vector, so we can replace direct includes with forward declarations
and then include the types where they're directly needed.

While we're at it, we can remove an unused inclusion of <cstring>, given
nothing in the header uses anything from it. This also revealed an
indirect inclusion, which this also resolves.
  • Loading branch information...
lioncash committed Jul 8, 2019
1 parent 98101bb commit a9a9b193bb864b540b7db65be2663cd31cb3a793
@@ -5,13 +5,16 @@
#pragma once

#include <cstddef>
#include <cstring>
#include <string>
#include <vector>

#include "Common/CommonTypes.h"
#include "Common/Debug/MemoryPatches.h"
#include "Common/Debug/Watches.h"

namespace Common::Debug
{
struct MemoryPatch;
struct Watch;
} // namespace Common::Debug

namespace Common
{
@@ -23,8 +26,8 @@ class DebugInterface
public:
// Watches
virtual std::size_t SetWatch(u32 address, std::string name = "") = 0;
virtual const Common::Debug::Watch& GetWatch(std::size_t index) const = 0;
virtual const std::vector<Common::Debug::Watch>& GetWatches() const = 0;
virtual const Debug::Watch& GetWatch(std::size_t index) const = 0;
virtual const std::vector<Debug::Watch>& GetWatches() const = 0;
virtual void UnsetWatch(u32 address) = 0;
virtual void UpdateWatch(std::size_t index, u32 address, std::string name) = 0;
virtual void UpdateWatchAddress(std::size_t index, u32 address) = 0;
@@ -40,7 +43,7 @@ class DebugInterface
// Memory Patches
virtual void SetPatch(u32 address, u32 value) = 0;
virtual void SetPatch(u32 address, std::vector<u8> value) = 0;
virtual const std::vector<Common::Debug::MemoryPatch>& GetPatches() const = 0;
virtual const std::vector<Debug::MemoryPatch>& GetPatches() const = 0;
virtual void UnsetPatch(u32 address) = 0;
virtual void EnablePatch(std::size_t index) = 0;
virtual void DisablePatch(std::size_t index) = 0;
@@ -7,6 +7,8 @@
#include <cstddef>
#include <string>

#include "Common/Debug/MemoryPatches.h"
#include "Common/Debug/Watches.h"
#include "Common/DebugInterface.h"

class PPCPatches : public Common::Debug::MemoryPatches
@@ -8,6 +8,8 @@
#include <string>

#include "Common/CommonTypes.h"
#include "Common/Debug/MemoryPatches.h"
#include "Common/Debug/Watches.h"
#include "Common/DebugInterface.h"

namespace DSP::LLE
@@ -5,6 +5,7 @@
#include "Core/PowerPC/PPCSymbolDB.h"

#include <algorithm>
#include <cstring>
#include <map>
#include <string>
#include <utility>

0 comments on commit a9a9b19

Please sign in to comment.
You can’t perform that action at this time.