1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 15:27:42 +00:00

DevTools: Remove redundant default destructor and forward declarations

Problem:
- Default destructors (and constructors) are in `.cpp` files. This
  prevents the compiler's optimizer from inlining them when it thinks
  inlining is appropriate (unless LTO is used).
- Forward declarations can prevent some optimizations, such as
  inlining of constructors and destructors.

Solution:
- Remove them or set them to `= default` and let the compiler handle
  the generation of them.
- Remove unneeded forward declarations.
This commit is contained in:
Lenny Maiorani 2021-05-21 13:15:07 -06:00 committed by Linus Groh
parent 4d34802f74
commit 6ac454e70a
9 changed files with 43 additions and 53 deletions

View file

@ -16,10 +16,6 @@ Project::Project(const String& root_path)
m_model = GUI::FileSystemModel::create(root_path, GUI::FileSystemModel::Mode::FilesAndDirectories); m_model = GUI::FileSystemModel::create(root_path, GUI::FileSystemModel::Mode::FilesAndDirectories);
} }
Project::~Project()
{
}
OwnPtr<Project> Project::open_with_root_path(const String& root_path) OwnPtr<Project> Project::open_with_root_path(const String& root_path)
{ {
if (!Core::File::is_directory(root_path)) if (!Core::File::is_directory(root_path))

View file

@ -19,8 +19,6 @@ class Project {
AK_MAKE_NONMOVABLE(Project); AK_MAKE_NONMOVABLE(Project);
public: public:
~Project();
static OwnPtr<Project> open_with_root_path(const String& root_path); static OwnPtr<Project> open_with_root_path(const String& root_path);
GUI::FileSystemModel& model() { return *m_model; } GUI::FileSystemModel& model() { return *m_model; }

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <InspectorServer/InspectorClientEndpoint.h>
#include <InspectorServer/InspectorServerEndpoint.h>
#include <LibIPC/ServerConnection.h>
namespace Inspector {
class InspectorServerClient final
: public IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>
, public InspectorClientEndpoint {
C_OBJECT(InspectorServerClient);
public:
virtual void handshake() override
{
greet();
}
virtual ~InspectorServerClient() override = default;
private:
InspectorServerClient()
: IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, "/tmp/portal/inspector")
{
handshake();
}
virtual void dummy() override { }
};
}

View file

@ -8,37 +8,11 @@
#include "RemoteObject.h" #include "RemoteObject.h"
#include "RemoteObjectGraphModel.h" #include "RemoteObjectGraphModel.h"
#include "RemoteObjectPropertyModel.h" #include "RemoteObjectPropertyModel.h"
#include <InspectorServer/InspectorClientEndpoint.h>
#include <InspectorServer/InspectorServerEndpoint.h>
#include <LibIPC/ServerConnection.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
namespace Inspector { namespace Inspector {
class InspectorServerClient final
: public IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>
, public InspectorClientEndpoint {
C_OBJECT(InspectorServerClient);
public:
virtual void handshake() override
{
greet();
}
virtual ~InspectorServerClient() override { }
private:
InspectorServerClient()
: IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, "/tmp/portal/inspector")
{
handshake();
}
virtual void dummy() override { }
};
RemoteProcess* s_the; RemoteProcess* s_the;
RemoteProcess& RemoteProcess::the() RemoteProcess& RemoteProcess::the()
@ -54,10 +28,6 @@ RemoteProcess::RemoteProcess(pid_t pid)
m_client = InspectorServerClient::construct(); m_client = InspectorServerClient::construct();
} }
RemoteProcess::~RemoteProcess()
{
}
void RemoteProcess::handle_identify_response(const JsonObject& response) void RemoteProcess::handle_identify_response(const JsonObject& response)
{ {
int pid = response.get("pid").to_int(); int pid = response.get("pid").to_int();

View file

@ -6,12 +6,12 @@
#pragma once #pragma once
#include "InspectorServerClient.h"
#include <AK/NonnullOwnPtrVector.h> #include <AK/NonnullOwnPtrVector.h>
#include <LibCore/LocalSocket.h> #include <LibCore/LocalSocket.h>
namespace Inspector { namespace Inspector {
class InspectorServerClient;
class RemoteObjectGraphModel; class RemoteObjectGraphModel;
class RemoteObject; class RemoteObject;
@ -20,7 +20,6 @@ public:
static RemoteProcess& the(); static RemoteProcess& the();
explicit RemoteProcess(pid_t); explicit RemoteProcess(pid_t);
~RemoteProcess();
void update(); void update();
pid_t pid() const { return m_pid; } pid_t pid() const { return m_pid; }

View file

@ -47,10 +47,6 @@ Profile::Profile(Vector<Process> processes, Vector<Event> events)
rebuild_tree(); rebuild_tree();
} }
Profile::~Profile()
{
}
GUI::Model& Profile::model() GUI::Model& Profile::model()
{ {
return *m_model; return *m_model;

View file

@ -6,7 +6,11 @@
#pragma once #pragma once
#include "DisassemblyModel.h"
#include "Process.h" #include "Process.h"
#include "Profile.h"
#include "ProfileModel.h"
#include "SamplesModel.h"
#include <AK/Bitmap.h> #include <AK/Bitmap.h>
#include <AK/FlyString.h> #include <AK/FlyString.h>
#include <AK/JsonArray.h> #include <AK/JsonArray.h>
@ -22,11 +26,6 @@
namespace Profiler { namespace Profiler {
class DisassemblyModel;
class Profile;
class ProfileModel;
class SamplesModel;
class ProfileNode : public RefCounted<ProfileNode> { class ProfileNode : public RefCounted<ProfileNode> {
public: public:
static NonnullRefPtr<ProfileNode> create(FlyString object_name, String symbol, u32 address, u32 offset, u64 timestamp, pid_t pid) static NonnullRefPtr<ProfileNode> create(FlyString object_name, String symbol, u32 address, u32 offset, u64 timestamp, pid_t pid)
@ -130,7 +129,6 @@ struct ProcessFilter {
class Profile { class Profile {
public: public:
static Result<NonnullOwnPtr<Profile>, String> load_from_perfcore_file(const StringView& path); static Result<NonnullOwnPtr<Profile>, String> load_from_perfcore_file(const StringView& path);
~Profile();
GUI::Model& model(); GUI::Model& model();
GUI::Model& samples_model(); GUI::Model& samples_model();

View file

@ -26,10 +26,6 @@ void RangeAllocator::initialize_with_range(VirtualAddress base, size_t size)
m_available_ranges.append({ base, size }); m_available_ranges.append({ base, size });
} }
RangeAllocator::~RangeAllocator()
{
}
void RangeAllocator::dump() const void RangeAllocator::dump() const
{ {
dbgln("RangeAllocator({})", this); dbgln("RangeAllocator({})", this);

View file

@ -14,7 +14,6 @@ namespace UserspaceEmulator {
class RangeAllocator { class RangeAllocator {
public: public:
RangeAllocator(); RangeAllocator();
~RangeAllocator();
void initialize_with_range(VirtualAddress, size_t); void initialize_with_range(VirtualAddress, size_t);