Skip to content

Commit 6c32c9f

Browse files
authored
[cleanup] Remove unneeded StdToWX::ToArrayString calls (#3854)
1 parent d561441 commit 6c32c9f

Some content is hidden

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

50 files changed

+511
-560
lines changed

.github/workflows/macos.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ jobs:
1717
macos:
1818
runs-on: macos-latest
1919

20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
wx-version: ['v3.2.8']
24+
wx-options: ['--enable-stl', '--disable-stl']
25+
2026
steps:
2127

2228
- name: Install Codelite's dependencies
@@ -37,15 +43,15 @@ jobs:
3743
uses: actions/checkout@v4
3844
with:
3945
repository: wxWidgets/wxWidgets
40-
ref: v3.2.8
46+
ref: ${{ matrix.wx-version }}
4147
submodules: recursive
4248
path: wxWidgets
4349

4450
- name: Build and install wxWidgets
4551
run: |
4652
mkdir wxWidgets/build-release
4753
cd wxWidgets/build-release
48-
../configure --enable-shared --enable-monolithic --with-osx_cocoa CXX='clang++ -std=c++17 -stdlib=libc++ -I../src/tiff/libtiff' CC=clang --disable-debug --disable-mediactrl --enable-stl
54+
../configure --enable-shared --enable-monolithic --with-osx_cocoa CXX='clang++ -std=c++17 -stdlib=libc++ -I../src/tiff/libtiff' CC=clang --disable-debug --disable-mediactrl ${{ matrix.wx-options }}
4955
make -j$(sysctl -n hw.physicalcpu)
5056
sudo make install
5157

CMakePlugin/CMakePlugin.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#include "AsyncProcess/processreaderthread.h"
5757
#include "CMakeBuilder.h"
5858
#include "ICompilerLocator.h"
59-
#include "StdToWX.h"
6059
#include "StringUtils.h"
6160
#include "build_config.h"
6261
#include "environmentconfig.h"
@@ -174,13 +173,13 @@ wxArrayString CMakePlugin::GetSupportedGenerators() const
174173
{
175174
#ifdef __WXMSW__
176175
// Windows supported generators
177-
return StdToWX::ToArrayString({"MinGW Makefiles"});
176+
return {"MinGW Makefiles"};
178177
#else
179178
// Linux / Mac supported generators
180-
return StdToWX::ToArrayString({
179+
return {
181180
"Unix Makefiles",
182181
// "Ninja",
183-
});
182+
};
184183
#endif
185184
}
186185

@@ -515,11 +514,10 @@ bool CMakePlugin::IsCMakeListsExists() const
515514
return false;
516515
}
517516

518-
wxString CMakePlugin::WriteCMakeListsAndOpenIt(const std::vector<wxString>& lines) const
517+
wxString CMakePlugin::WriteCMakeListsAndOpenIt(const wxString& lines) const
519518
{
520519
wxFileName cmakelists_txt{::wxGetCwd(), "CMakeLists.txt"};
521-
const wxArrayString wx_lines = StdToWX::ToArrayString(lines);
522-
FileUtils::WriteFileContent(cmakelists_txt, wxJoin(wx_lines, '\n'));
520+
FileUtils::WriteFileContent(cmakelists_txt, lines);
523521
clGetManager()->OpenFile(cmakelists_txt.GetFullPath());
524522
return cmakelists_txt.GetFullPath();
525523
}
@@ -552,28 +550,30 @@ clStatusOr<wxString> CMakePlugin::CreateCMakeListsFile(CMakePlugin::TargetType t
552550
return StatusOther("User cancelled");
553551
}
554552

555-
wxString cmakelists_txt = WriteCMakeListsAndOpenIt({
556-
"cmake_minimum_required(VERSION 3.16)",
557-
wxString::Format("project(%s)", name),
558-
wxEmptyString,
559-
wxEmptyString,
560-
"set(CMAKE_EXPORT_COMPILE_COMMANDS 1)",
561-
"set(CMAKE_CXX_STANDARD 17)",
562-
"set(CMAKE_CXX_STANDARD_REQUIRED ON)",
563-
wxEmptyString,
564-
"file(GLOB CXX_SRCS \"*.cpp\")",
565-
"file(GLOB C_SRCS \"*.c\")",
566-
wxEmptyString,
567-
target_line,
568-
"if(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})",
569-
" add_custom_command(",
570-
wxString::Format(" TARGET %s", name),
571-
" POST_BUILD",
572-
" COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/compile_commands.json",
573-
" ${CMAKE_SOURCE_DIR}/compile_commands.json)",
574-
"endif()",
575-
wxEmptyString,
576-
});
553+
wxString cmakelists_txt = WriteCMakeListsAndOpenIt(
554+
wxString::Format("cmake_minimum_required(VERSION 3.16)\n"
555+
"project(%s)\n"
556+
"\n"
557+
"\n"
558+
"set(CMAKE_EXPORT_COMPILE_COMMANDS 1)\n"
559+
"set(CMAKE_CXX_STANDARD 17)\n"
560+
"set(CMAKE_CXX_STANDARD_REQUIRED ON)\n"
561+
"\n"
562+
"file(GLOB CXX_SRCS \"*.cpp\")\n"
563+
"file(GLOB C_SRCS \"*.c\")\n"
564+
"\n"
565+
"%s\n"
566+
"if(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})\n"
567+
" add_custom_command(\n"
568+
" TARGET %s\n"
569+
" POST_BUILD\n"
570+
" COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/compile_commands.json\n"
571+
" ${CMAKE_SOURCE_DIR}/compile_commands.json)\n"
572+
"endif()\n"
573+
"\n",
574+
name,
575+
target_line,
576+
name));
577577
return cmakelists_txt;
578578
}
579579

CMakePlugin/CMakePlugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ class CMakePlugin : public IPlugin
249249
void OnCreateCMakeListsDll(wxCommandEvent& event);
250250
void OnCreateCMakeListsLib(wxCommandEvent& event);
251251
bool IsCMakeListsExists() const;
252-
wxString WriteCMakeListsAndOpenIt(const std::vector<wxString>& lines) const;
252+
wxString WriteCMakeListsAndOpenIt(const wxString& lines) const;
253253
clStatusOr<wxString> CreateCMakeListsFile(TargetType type) const;
254254
void FireCMakeListsFileCreatedEvent(const wxString& cmakelists_txt) const;
255255

CodeLite/AsyncProcess/asyncprocess.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class IProcess;
2828

2929
#include "asyncprocess.h"
3030

31-
#include "StdToWX.h"
3231
#include "StringUtils.h"
3332
#include "clTempFile.hpp"
3433
#include "cl_command_event.h"
@@ -115,9 +114,9 @@ static wxArrayString __WrapInShell(const wxArrayString& args, size_t flags)
115114
if (shell.IsEmpty()) {
116115
shell = "CMD.EXE";
117116
}
118-
return StdToWX::ToArrayString({shell, "/C", "\"" + cmd + "\""});
117+
return {shell, wxString("/C"), "\"" + cmd + "\""};
119118
} else {
120-
return StdToWX::ToArrayString({"/bin/sh", "-c", "'" + cmd + "'"});
119+
return {wxString("/bin/sh"), wxString("-c"), "'" + cmd + "'"};
121120
}
122121
}
123122

CodeLite/Console/clConsoleBase.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "clConsoleBase.h"
22

3-
#include "StdToWX.h"
43
#include "clConsoleAlacritty.hpp"
54
#include "clConsoleCMD.h"
65
#include "clConsoleGnomeTerminal.h"
@@ -95,16 +94,25 @@ clConsoleBase::Ptr_t clConsoleBase::GetTerminal()
9594

9695
wxArrayString clConsoleBase::GetAvailableTerminals()
9796
{
98-
return StdToWX::ToArrayString({
97+
return {
9998
#ifdef __WXMSW__
10099
"CMD",
101100
#elif defined(__WXGTK__)
102-
"konsole", "gnome-terminal", "lxterminal", "mate-terminal", "qterminal",
103-
"xfce4-terminal", "rxvt-unicode", "kgx", "Kitty",
101+
"konsole",
102+
"gnome-terminal",
103+
"lxterminal",
104+
"mate-terminal",
105+
"qterminal",
106+
"xfce4-terminal",
107+
"rxvt-unicode",
108+
"kgx",
109+
"Kitty",
104110
#else
105-
"Terminal", "iTerm2", "Kitty",
111+
"Terminal",
112+
"iTerm2",
113+
"Kitty",
106114
#endif
107-
"alacritty" });
115+
"alacritty"};
108116
}
109117

110118
wxString clConsoleBase::WrapWithQuotesIfNeeded(const wxString& s) const

CodeLite/Console/clConsoleRXVTerminal.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#include "clConsoleRXVTerminal.h"
22

33
#include "Platform/Platform.hpp"
4-
#include "StdToWX.h"
54

65
clConsoleRXVTTerminal::clConsoleRXVTTerminal()
76
{
8-
const wxArrayString commands = StdToWX::ToArrayString({"rxvt-unicode", "urxvt", "rxvt"});
7+
const wxArrayString commands = {"rxvt-unicode", "urxvt", "rxvt"};
98
const auto executable = ThePlatform->AnyWhich(commands);
109

1110
SetTerminalCommand(executable.value_or("rxvt-unicode") + " -cd %WD% -e /bin/bash -c '%COMMAND%'");

CodeLite/Cxx/CxxCodeCompletion.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "CxxExpression.hpp"
55
#include "CxxScannerTokens.h"
66
#include "CxxVariableScanner.h"
7-
#include "StdToWX.h"
87
#include "file_logger.h"
98
#include "fileextmanager.h"
109
#include "fileutils.h"
@@ -210,8 +209,7 @@ void CxxCodeCompletion::shrink_scope(const wxString& text, std::unordered_map<wx
210209
}
211210

212211
// we also include the anonymous entries for this scope
213-
const wxArrayString kinds =
214-
StdToWX::ToArrayString({ "class", "struct", "namespace", "member", "function", "variable", "enum", "macro" });
212+
const wxArrayString kinds = {"class", "struct", "namespace", "member", "function", "variable", "enum", "macro"};
215213
std::vector<TagEntryPtr> anonymous_tags;
216214
get_anonymous_tags(wxEmptyString, kinds, anonymous_tags);
217215

CodeLite/ctags_manager.cpp

Lines changed: 46 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "Cxx/CxxLexerAPI.h"
2929
#include "Cxx/CxxVariableScanner.h"
3030
#include "Cxx/cpp_comment_creator.h"
31-
#include "StdToWX.h"
3231
#include "cl_command_event.h"
3332
#include "codelite_events.h"
3433
#include "database/tags_storage_sqlite3.h"
@@ -208,7 +207,7 @@ bool TagsManager::GetDerivationListInternal(const wxString& path, TagEntryPtr de
208207
{
209208
std::vector<TagEntryPtr> tags;
210209
TagEntryPtr tag;
211-
const wxArrayString kind = StdToWX::ToArrayString({ wxT("class"), wxT("struct") });
210+
const wxArrayString kind = { wxT("class"), wxT("struct") };
212211

213212
GetDatabase()->GetTagsByKindAndPath(kind, path, tags);
214213

@@ -380,7 +379,7 @@ Language* TagsManager::GetLanguage()
380379

381380
void TagsManager::GetClasses(std::vector<TagEntryPtr>& tags)
382381
{
383-
const wxArrayString kind = StdToWX::ToArrayString({ wxT("class"), wxT("struct"), wxT("union") });
382+
const wxArrayString kind = {wxT("class"), wxT("struct"), wxT("union")};
384383

385384
GetDatabase()->GetTagsByKind(kind, wxT("name"), ITagsStorage::OrderAsc, tags);
386385
}
@@ -456,7 +455,7 @@ void TagsManager::CacheFile(const wxString& fileName)
456455
m_cachedFile = fileName;
457456
m_cachedFileFunctionsTags.clear();
458457

459-
const wxArrayString kinds = StdToWX::ToArrayString({ wxT("function"), wxT("prototype") });
458+
const wxArrayString kinds = {wxT("function"), wxT("prototype")};
460459
// disable the cache
461460
GetDatabase()->SetUseCache(false);
462461
GetDatabase()->GetTagsByKindAndFile(kinds, fileName, wxT("line"), ITagsStorage::OrderDesc,
@@ -690,49 +689,49 @@ void TagsManager::GetCXXKeywords(wxStringSet_t& words)
690689

691690
void TagsManager::GetCXXKeywords(wxArrayString& words)
692691
{
693-
words = StdToWX::ToArrayString({ "alignas", "alignof",
694-
"and", "and_eq",
695-
"asm", "auto",
696-
"bitand", "bitor",
697-
"bool", "break",
698-
"case", "catch",
699-
"char", "char16_t",
700-
"char32_t", "class",
701-
"compl", "const",
702-
"constexpr", "const_cast",
703-
"continue", "decltype",
704-
"default", "delete",
705-
"do", "double",
706-
"dynamic_cast", "else",
707-
"enum", "explicit",
708-
"export", "extern",
709-
"false", "final",
710-
"float", "for",
711-
"friend", "goto",
712-
"if", "inline",
713-
"int", "long",
714-
"mutable", "namespace",
715-
"new", "noexcept",
716-
"not", "not_eq",
717-
"nullptr", "operator",
718-
"or", "or_eq",
719-
"override", "private",
720-
"protected", "public",
721-
"register", "reinterpret_cast",
722-
"return", "short",
723-
"signed", "sizeof",
724-
"static", "static_assert",
725-
"static_cast", "struct",
726-
"switch", "template",
727-
"this", "thread_local",
728-
"throw", "true",
729-
"try", "typedef",
730-
"typeid", "typename",
731-
"union", "unsigned",
732-
"using", "virtual",
733-
"void", "volatile",
734-
"wchar_t", "while",
735-
"xor", "xor_eq" });
692+
words = {"alignas", "alignof",
693+
"and", "and_eq",
694+
"asm", "auto",
695+
"bitand", "bitor",
696+
"bool", "break",
697+
"case", "catch",
698+
"char", "char16_t",
699+
"char32_t", "class",
700+
"compl", "const",
701+
"constexpr", "const_cast",
702+
"continue", "decltype",
703+
"default", "delete",
704+
"do", "double",
705+
"dynamic_cast", "else",
706+
"enum", "explicit",
707+
"export", "extern",
708+
"false", "final",
709+
"float", "for",
710+
"friend", "goto",
711+
"if", "inline",
712+
"int", "long",
713+
"mutable", "namespace",
714+
"new", "noexcept",
715+
"not", "not_eq",
716+
"nullptr", "operator",
717+
"or", "or_eq",
718+
"override", "private",
719+
"protected", "public",
720+
"register", "reinterpret_cast",
721+
"return", "short",
722+
"signed", "sizeof",
723+
"static", "static_assert",
724+
"static_cast", "struct",
725+
"switch", "template",
726+
"this", "thread_local",
727+
"throw", "true",
728+
"try", "typedef",
729+
"typeid", "typename",
730+
"union", "unsigned",
731+
"using", "virtual",
732+
"void", "volatile",
733+
"wchar_t", "while",
734+
"xor", "xor_eq"};
736735
}
737736

738737
TagEntryPtrVector_t TagsManager::ParseBuffer(const wxString& content, const wxString& filename, const wxString& kinds)

0 commit comments

Comments
 (0)