Skip to content

Commit 59fa698

Browse files
authored
Clang format (#3878)
- git/*.* - Codelite/**.*
1 parent b28dc21 commit 59fa698

File tree

217 files changed

+4276
-3898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+4276
-3898
lines changed

.clang-format

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ IncludeCategories:
2525
- Regex: '^<wx/wxprec.h>'
2626
Priority: -1
2727
SortPriority: 0
28+
- Regex: '^"precompiled_header.h"'
29+
Priority: -1
30+
SortPriority: 0
2831
- Regex: '^".*"'
2932
Priority: 1
3033
SortPriority: 0
@@ -54,7 +57,7 @@ SpacesInAngles: false
5457
SpacesInContainerLiterals: true
5558
SpacesInCStyleCastParentheses: false
5659
SpacesInParentheses: false
57-
Standard: C++11
60+
Standard: c++20
5861
TabWidth: 4
5962
UseTab: Never
6063
SortIncludes: true

CodeLite/AsyncProcess/ChildProcess.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
ChildProcess::~ChildProcess()
1212
{
1313
#if USE_IPROCESS
14-
if(m_process) {
14+
if (m_process) {
1515
m_process->Detach();
1616
}
1717
#else
18-
if(m_childProcess) {
18+
if (m_childProcess) {
1919
m_childProcess->Detach();
2020
}
2121
#endif
@@ -25,7 +25,7 @@ namespace
2525
{
2626
wxString& wrap_with_quotes(wxString& str)
2727
{
28-
if(!str.empty() && str.Contains(" ") && !str.StartsWith("\"") && !str.EndsWith("\"")) {
28+
if (!str.empty() && str.Contains(" ") && !str.StartsWith("\"") && !str.EndsWith("\"")) {
2929
str.Prepend("\"").Append("\"");
3030
}
3131
return str;
@@ -34,7 +34,7 @@ wxString& wrap_with_quotes(wxString& str)
3434

3535
void ChildProcess::Start(const wxArrayString& args)
3636
{
37-
if(args.IsEmpty()) {
37+
if (args.IsEmpty()) {
3838
return;
3939
}
4040
#if USE_IPROCESS
@@ -51,7 +51,7 @@ void ChildProcess::Start(const wxArrayString& args)
5151

5252
// Launch the process
5353
m_process.reset(::CreateAsyncProcess(this, command, IProcessCreateDefault | IProcessStderrEvent));
54-
if(!m_process) {
54+
if (!m_process) {
5555
throw clException(wxString() << "Failed to execute process: " << command);
5656
};
5757
#else
@@ -63,7 +63,7 @@ void ChildProcess::Write(const wxString& message) { Write(StringUtils::ToStdStri
6363

6464
void ChildProcess::Write(const std::string& message)
6565
{
66-
if(!IsOk()) {
66+
if (!IsOk()) {
6767
return;
6868
}
6969
#if USE_IPROCESS

CodeLite/AsyncProcess/TerminalEmulator.cpp

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,25 @@ class MyProcess : public wxProcess
2323
: wxProcess(parent)
2424
, m_parent(parent)
2525
{
26-
if(m_parent) { m_parent->m_myProcesses.push_back(this); }
26+
if (m_parent) {
27+
m_parent->m_myProcesses.push_back(this);
28+
}
2729
}
2830

2931
virtual ~MyProcess() { m_parent = NULL; }
3032
void OnTerminate(int pid, int status)
3133
{
32-
if(m_parent) {
34+
if (m_parent) {
3335
clCommandEvent terminateEvent(wxEVT_TERMINAL_COMMAND_EXIT);
3436
m_parent->AddPendingEvent(terminateEvent);
3537
m_parent->m_pid = wxNOT_FOUND;
3638

37-
std::list<wxProcess*>::iterator iter =
38-
std::find_if(m_parent->m_myProcesses.begin(), m_parent->m_myProcesses.end(),
39-
[&](wxProcess* proc) { return proc == this; });
40-
if(iter != m_parent->m_myProcesses.end()) { m_parent->m_myProcesses.erase(iter); }
39+
std::list<wxProcess*>::iterator iter = std::find_if(m_parent->m_myProcesses.begin(),
40+
m_parent->m_myProcesses.end(),
41+
[&](wxProcess* proc) { return proc == this; });
42+
if (iter != m_parent->m_myProcesses.end()) {
43+
m_parent->m_myProcesses.erase(iter);
44+
}
4145
delete this;
4246
}
4347
}
@@ -61,8 +65,11 @@ TerminalEmulator::~TerminalEmulator()
6165
}
6266
}
6367

64-
bool TerminalEmulator::ExecuteConsole(const wxString& command, bool waitOnExit, const wxString& command_args,
65-
const wxString& workingDirectory, const wxString& title)
68+
bool TerminalEmulator::ExecuteConsole(const wxString& command,
69+
bool waitOnExit,
70+
const wxString& command_args,
71+
const wxString& workingDirectory,
72+
const wxString& title)
6673
{
6774
wxUnusedVar(title);
6875
clConsoleBase::Ptr_t console = clConsoleBase::GetTerminal();
@@ -72,7 +79,7 @@ bool TerminalEmulator::ExecuteConsole(const wxString& command, bool waitOnExit,
7279
console->SetCallback(new MyProcess(this));
7380

7481
wxString strTitle = title;
75-
if(strTitle.IsEmpty()) {
82+
if (strTitle.IsEmpty()) {
7683
strTitle << "'" << command << "'";
7784
} else {
7885
strTitle.Prepend("'").Append("'");
@@ -94,9 +101,11 @@ void TerminalEmulator::OnProcessTerminated(clProcessEvent& event)
94101

95102
void TerminalEmulator::Terminate()
96103
{
97-
if(IsRunning()) {
98-
if(m_process) { m_process->Terminate(); }
99-
if(m_pid != wxNOT_FOUND) {
104+
if (IsRunning()) {
105+
if (m_process) {
106+
m_process->Terminate();
107+
}
108+
if (m_pid != wxNOT_FOUND) {
100109
wxKill(m_pid, wxSIGKILL, NULL, wxKILL_CHILDREN);
101110
m_pid = wxNOT_FOUND;
102111
}
@@ -114,15 +123,17 @@ void TerminalEmulator::OnProcessOutput(clProcessEvent& event)
114123

115124
bool TerminalEmulator::ExecuteNoConsole(const wxString& commandToRun, const wxString& workingDirectory)
116125
{
117-
if(m_process) {
126+
if (m_process) {
118127
// another process is running
119128
return false;
120129
}
121130

122131
wxString command;
123132
#ifdef __WXMSW__
124133
wxString shell = wxGetenv("COMSPEC");
125-
if(shell.IsEmpty()) { shell = "CMD"; }
134+
if (shell.IsEmpty()) {
135+
shell = "CMD";
136+
}
126137

127138
command << shell << wxT(" /c \"");
128139
command << commandToRun << wxT("\"");

CodeLite/AsyncProcess/TerminalEmulator.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ class WXDLLIMPEXP_CL TerminalEmulator : public wxEvtHandler
7373
* "Hit any key to continue"
7474
* @param title set the terminal title. If an empty string is provided, use the command as the title
7575
*/
76-
bool ExecuteConsole(const wxString& command, bool waitOnExit = false, const wxString& command_args = "",
77-
const wxString& workingDirectory = "", const wxString& title = "");
76+
bool ExecuteConsole(const wxString& command,
77+
bool waitOnExit = false,
78+
const wxString& command_args = "",
79+
const wxString& workingDirectory = "",
80+
const wxString& title = "");
7881
/**
7982
* @brief execute a command without attaching console
8083
*/

CodeLite/AsyncProcess/TerminalEmulatorFrame.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ TerminalEmulatorFrame::TerminalEmulatorFrame(wxWindow* parent)
44
: TerminalEmulatorFrameBase(parent)
55
{
66
m_terminal = new TerminalEmulatorUI(this);
7-
GetSizer()->Add(m_terminal, 1, wxEXPAND|wxALL);
8-
7+
GetSizer()->Add(m_terminal, 1, wxEXPAND | wxALL);
98
}
109
#endif // LIBCODELITE_WITH_UI

CodeLite/AsyncProcess/TerminalEmulatorFrame.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
#ifndef TERMINALEMULATORFRAME_H
2727
#define TERMINALEMULATORFRAME_H
2828

29-
#include "TerminalEmulatorUIBase.h"
3029
#include "TerminalEmulatorUI.h"
30+
#include "TerminalEmulatorUIBase.h"
3131
#if wxUSE_GUI
3232
class WXDLLIMPEXP_CL TerminalEmulatorFrame : public TerminalEmulatorFrameBase
3333
{
3434
TerminalEmulatorUI* m_terminal;
35+
3536
public:
3637
TerminalEmulatorFrame(wxWindow* parent);
3738
virtual ~TerminalEmulatorFrame() = default;

CodeLite/AsyncProcess/TerminalEmulatorUI.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ void TerminalEmulatorUI::OnSendCommand(wxCommandEvent& event) {}
1010

1111
void TerminalEmulatorUI::SetTerminal(TerminalEmulator* terminal)
1212
{
13-
if(m_terminal) {
13+
if (m_terminal) {
1414
DoUnBindTerminal(m_terminal);
1515
}
1616
this->m_terminal = terminal;
17-
if(m_terminal) {
17+
if (m_terminal) {
1818
DoBindTerminal(m_terminal);
1919
}
2020
}
2121

2222
void TerminalEmulatorUI::OnProcessExit(clCommandEvent& e)
2323
{
2424
e.Skip();
25-
if(m_terminal) {
25+
if (m_terminal) {
2626
DoUnBindTerminal(m_terminal);
2727
m_terminal = NULL;
2828
}
@@ -43,15 +43,15 @@ void TerminalEmulatorUI::OnProcessOutput(clCommandEvent& e)
4343

4444
void TerminalEmulatorUI::DoBindTerminal(TerminalEmulator* terminal)
4545
{
46-
if(terminal) {
46+
if (terminal) {
4747
terminal->Bind(wxEVT_TERMINAL_COMMAND_EXIT, &TerminalEmulatorUI::OnProcessExit, this);
4848
terminal->Bind(wxEVT_TERMINAL_COMMAND_OUTPUT, &TerminalEmulatorUI::OnProcessOutput, this);
4949
}
5050
}
5151

5252
void TerminalEmulatorUI::DoUnBindTerminal(TerminalEmulator* terminal)
5353
{
54-
if(terminal) {
54+
if (terminal) {
5555
terminal->Unbind(wxEVT_TERMINAL_COMMAND_EXIT, &TerminalEmulatorUI::OnProcessExit, this);
5656
terminal->Unbind(wxEVT_TERMINAL_COMMAND_OUTPUT, &TerminalEmulatorUI::OnProcessOutput, this);
5757
}

CodeLite/AsyncProcess/TerminalEmulatorUI.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,26 @@
2929
#include <wx/setup.h>
3030

3131
#if wxUSE_GUI
32-
#include "TerminalEmulatorUIBase.h"
3332
#include "TerminalEmulator.h"
33+
#include "TerminalEmulatorUIBase.h"
3434

3535
class WXDLLIMPEXP_CL TerminalEmulatorUI : public TerminalEmulatorUIBase
3636
{
3737
TerminalEmulator* m_terminal;
38+
3839
private:
3940
void DoBindTerminal(TerminalEmulator* terminal);
4041
void DoUnBindTerminal(TerminalEmulator* terminal);
41-
42+
4243
public:
4344
TerminalEmulatorUI(wxWindow* parent);
4445
virtual ~TerminalEmulatorUI() = default;
4546

4647
void Clear();
47-
void SetTerminal(TerminalEmulator* terminal) ;
48+
void SetTerminal(TerminalEmulator* terminal);
4849
TerminalEmulator* GetTerminal() { return m_terminal; }
4950
wxStyledTextCtrl* GetTerminalOutputWindow() { return m_stc; }
50-
51+
5152
protected:
5253
virtual void OnSendCommand(wxCommandEvent& event);
5354
void OnProcessExit(clCommandEvent& e);

CodeLite/AsyncProcess/UnixProcess.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
#ifndef UNIX_PROCESS_H
22
#define UNIX_PROCESS_H
33
#if defined(__WXGTK__) || defined(__WXOSX__)
4+
#include <atomic>
45
#include <exception>
56
#include <functional>
67
#include <iostream>
78
#include <memory>
89
#include <sys/wait.h>
910
#include <thread>
1011
#include <unistd.h>
11-
#include <wx/thread.h>
12-
#include <wx/msgqueue.h>
13-
#include <atomic>
1412
#include <wx/event.h>
13+
#include <wx/msgqueue.h>
14+
#include <wx/thread.h>
1515

1616
// Wrapping pipe in a class makes sure they are closed when we leave scope
17-
#define CLOSE_FD(fd) \
18-
if(fd != wxNOT_FOUND) { \
19-
::close(fd); \
20-
fd = wxNOT_FOUND; \
17+
#define CLOSE_FD(fd) \
18+
if (fd != wxNOT_FOUND) { \
19+
::close(fd); \
20+
fd = wxNOT_FOUND; \
2121
}
2222

2323
class CPipe
@@ -39,7 +39,7 @@ class CPipe
3939
bool Open()
4040
{
4141
int fd[2];
42-
if(pipe(fd) == 0) {
42+
if (pipe(fd) == 0) {
4343
m_readFd = fd[0];
4444
m_writeFd = fd[1];
4545
return true;

CodeLite/AsyncProcess/ZombieReaperPOSIX.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ ZombieReaperPOSIX::ZombieReaperPOSIX()
4242

4343
void* ZombieReaperPOSIX::Entry()
4444
{
45-
while(!TestDestroy()) {
45+
while (!TestDestroy()) {
4646
int status(0);
4747
pid_t pid = ::waitpid((pid_t)-1, &status, WNOHANG);
48-
if(pid > 0) {
48+
if (pid > 0) {
4949
// Notify about this process termination
5050
wxProcessEvent event(0, pid, status);
5151
event.SetEventType(wxEVT_CL_PROCESS_TERMINATED);
@@ -61,7 +61,7 @@ void* ZombieReaperPOSIX::Entry()
6161

6262
void ZombieReaperPOSIX::Stop()
6363
{
64-
if(IsAlive()) {
64+
if (IsAlive()) {
6565
Delete(NULL, wxTHREAD_WAIT_BLOCK);
6666
} else {
6767
Wait(wxTHREAD_WAIT_BLOCK);

0 commit comments

Comments
 (0)