Skip to content

Commit 6ac454e

Browse files
ldm5180linusg
authored andcommitted
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.
1 parent 4d34802 commit 6ac454e

File tree

9 files changed

+43
-53
lines changed

9 files changed

+43
-53
lines changed

Userland/DevTools/HackStudio/Project.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ Project::Project(const String& root_path)
1616
m_model = GUI::FileSystemModel::create(root_path, GUI::FileSystemModel::Mode::FilesAndDirectories);
1717
}
1818

19-
Project::~Project()
20-
{
21-
}
22-
2319
OwnPtr<Project> Project::open_with_root_path(const String& root_path)
2420
{
2521
if (!Core::File::is_directory(root_path))

Userland/DevTools/HackStudio/Project.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class Project {
1919
AK_MAKE_NONMOVABLE(Project);
2020

2121
public:
22-
~Project();
23-
2422
static OwnPtr<Project> open_with_root_path(const String& root_path);
2523

2624
GUI::FileSystemModel& model() { return *m_model; }
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
3+
*
4+
* SPDX-License-Identifier: BSD-2-Clause
5+
*/
6+
7+
#pragma once
8+
9+
#include <InspectorServer/InspectorClientEndpoint.h>
10+
#include <InspectorServer/InspectorServerEndpoint.h>
11+
#include <LibIPC/ServerConnection.h>
12+
13+
namespace Inspector {
14+
15+
class InspectorServerClient final
16+
: public IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>
17+
, public InspectorClientEndpoint {
18+
C_OBJECT(InspectorServerClient);
19+
20+
public:
21+
virtual void handshake() override
22+
{
23+
greet();
24+
}
25+
26+
virtual ~InspectorServerClient() override = default;
27+
28+
private:
29+
InspectorServerClient()
30+
: IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, "/tmp/portal/inspector")
31+
{
32+
handshake();
33+
}
34+
35+
virtual void dummy() override { }
36+
};
37+
38+
}

Userland/DevTools/Inspector/RemoteProcess.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,11 @@
88
#include "RemoteObject.h"
99
#include "RemoteObjectGraphModel.h"
1010
#include "RemoteObjectPropertyModel.h"
11-
#include <InspectorServer/InspectorClientEndpoint.h>
12-
#include <InspectorServer/InspectorServerEndpoint.h>
13-
#include <LibIPC/ServerConnection.h>
1411
#include <stdio.h>
1512
#include <stdlib.h>
1613

1714
namespace Inspector {
1815

19-
class InspectorServerClient final
20-
: public IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>
21-
, public InspectorClientEndpoint {
22-
C_OBJECT(InspectorServerClient);
23-
24-
public:
25-
virtual void handshake() override
26-
{
27-
greet();
28-
}
29-
30-
virtual ~InspectorServerClient() override { }
31-
32-
private:
33-
InspectorServerClient()
34-
: IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, "/tmp/portal/inspector")
35-
{
36-
handshake();
37-
}
38-
39-
virtual void dummy() override { }
40-
};
41-
4216
RemoteProcess* s_the;
4317

4418
RemoteProcess& RemoteProcess::the()
@@ -54,10 +28,6 @@ RemoteProcess::RemoteProcess(pid_t pid)
5428
m_client = InspectorServerClient::construct();
5529
}
5630

57-
RemoteProcess::~RemoteProcess()
58-
{
59-
}
60-
6131
void RemoteProcess::handle_identify_response(const JsonObject& response)
6232
{
6333
int pid = response.get("pid").to_int();

Userland/DevTools/Inspector/RemoteProcess.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
#pragma once
88

9+
#include "InspectorServerClient.h"
910
#include <AK/NonnullOwnPtrVector.h>
1011
#include <LibCore/LocalSocket.h>
1112

1213
namespace Inspector {
1314

14-
class InspectorServerClient;
1515
class RemoteObjectGraphModel;
1616
class RemoteObject;
1717

@@ -20,7 +20,6 @@ class RemoteProcess {
2020
static RemoteProcess& the();
2121

2222
explicit RemoteProcess(pid_t);
23-
~RemoteProcess();
2423
void update();
2524

2625
pid_t pid() const { return m_pid; }

Userland/DevTools/Profiler/Profile.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ Profile::Profile(Vector<Process> processes, Vector<Event> events)
4747
rebuild_tree();
4848
}
4949

50-
Profile::~Profile()
51-
{
52-
}
53-
5450
GUI::Model& Profile::model()
5551
{
5652
return *m_model;

Userland/DevTools/Profiler/Profile.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
#pragma once
88

9+
#include "DisassemblyModel.h"
910
#include "Process.h"
11+
#include "Profile.h"
12+
#include "ProfileModel.h"
13+
#include "SamplesModel.h"
1014
#include <AK/Bitmap.h>
1115
#include <AK/FlyString.h>
1216
#include <AK/JsonArray.h>
@@ -22,11 +26,6 @@
2226

2327
namespace Profiler {
2428

25-
class DisassemblyModel;
26-
class Profile;
27-
class ProfileModel;
28-
class SamplesModel;
29-
3029
class ProfileNode : public RefCounted<ProfileNode> {
3130
public:
3231
static NonnullRefPtr<ProfileNode> create(FlyString object_name, String symbol, u32 address, u32 offset, u64 timestamp, pid_t pid)
@@ -130,7 +129,6 @@ struct ProcessFilter {
130129
class Profile {
131130
public:
132131
static Result<NonnullOwnPtr<Profile>, String> load_from_perfcore_file(const StringView& path);
133-
~Profile();
134132

135133
GUI::Model& model();
136134
GUI::Model& samples_model();

Userland/DevTools/UserspaceEmulator/RangeAllocator.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ void RangeAllocator::initialize_with_range(VirtualAddress base, size_t size)
2626
m_available_ranges.append({ base, size });
2727
}
2828

29-
RangeAllocator::~RangeAllocator()
30-
{
31-
}
32-
3329
void RangeAllocator::dump() const
3430
{
3531
dbgln("RangeAllocator({})", this);

Userland/DevTools/UserspaceEmulator/RangeAllocator.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ namespace UserspaceEmulator {
1414
class RangeAllocator {
1515
public:
1616
RangeAllocator();
17-
~RangeAllocator();
1817

1918
void initialize_with_range(VirtualAddress, size_t);
2019

0 commit comments

Comments
 (0)