Skip to content

Commit 004d709

Browse files
committed
llvm 21 linting fixes
1 parent abc5aa0 commit 004d709

File tree

14 files changed

+30
-29
lines changed

14 files changed

+30
-29
lines changed

src/unrealsdk/commands.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace impl {
8181
#ifndef UNREALSDK_IMPORTING
8282

8383
bool is_command_valid(std::wstring_view line, bool direct_user_input) {
84-
if (direct_user_input && commands.find(NEXT_LINE) != commands.end()) {
84+
if (direct_user_input && commands.contains(NEXT_LINE)) {
8585
return true;
8686
}
8787
auto non_space = std::ranges::find_if_not(line, &std::iswspace);

src/unrealsdk/game/bl1/bl1.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void BL1Hook::post_init(void) {
4343

4444
namespace {
4545

46-
#if defined(__MINGW32__)
46+
#ifdef __MINGW32__
4747
#pragma GCC diagnostic push
4848
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
4949
#endif
@@ -59,7 +59,7 @@ const constinit Pattern<11> GNATIVES_SIG{
5959
typedef void(__thiscall* fframe_step_func)(UObject*, FFrame*, void*);
6060
fframe_step_func** fframe_step_gnatives;
6161

62-
#if defined(__MINGW32__)
62+
#ifdef __MINGW32__
6363
#pragma GCC diagnostic pop
6464
#endif
6565

@@ -78,7 +78,7 @@ void BL1Hook::fframe_step(FFrame* frame, UObject* obj, void* param) const {
7878

7979
namespace {
8080

81-
#if defined(__MINGW32__)
81+
#ifdef __MINGW32__
8282
#pragma GCC diagnostic push
8383
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
8484
#endif
@@ -115,7 +115,7 @@ typedef void(__thiscall* fname_init_func)(FName* name,
115115

116116
fname_init_func fname_init_ptr = nullptr;
117117

118-
#if defined(__MINGW32__)
118+
#ifdef __MINGW32__
119119
#pragma GCC diagnostic pop
120120
#endif
121121

src/unrealsdk/game/bl1/memory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace unrealsdk::game {
1313

1414
namespace {
1515

16-
#if defined(__MINGW32__)
16+
#ifdef __MINGW32__
1717
#pragma GCC diagnostic push
1818
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
1919
#endif
@@ -29,7 +29,7 @@ struct FMalloc {
2929
FMallocVFtable* vftable;
3030
};
3131

32-
#if defined(__MINGW32__)
32+
#ifdef __MINGW32__
3333
#pragma GCC diagnostic pop
3434
#endif
3535

src/unrealsdk/game/bl1/object.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ UObject* BL1Hook::construct_object(UClass* cls,
6868

6969
namespace {
7070

71-
#if defined(__MINGW32__)
71+
#ifdef __MINGW32__
7272
#pragma GCC diagnostic push
7373
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
7474
#endif
@@ -78,7 +78,7 @@ typedef void(__thiscall* get_path_name_func)(const UObject* self,
7878
const UObject* stop_outer,
7979
ManagedFString* str);
8080

81-
#if defined(__MINGW32__)
81+
#ifdef __MINGW32__
8282
#pragma GCC diagnostic pop
8383
#endif
8484

src/unrealsdk/game/bl1/steamdrm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void GetStartupInfoA_hook(LPSTARTUPINFOA lpStartupInfo) {
3636
return;
3737
}
3838

39-
const std::lock_guard<std::mutex> lock{ready_mutex};
39+
const std::scoped_lock lock{ready_mutex};
4040
ready.store(true);
4141
ready_cv.notify_all();
4242
}

src/unrealsdk/game/bl2/bl2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void BL2Hook::post_init(void) {
4242
inject_console();
4343
}
4444

45-
#if defined(__MINGW32__)
45+
#ifdef __MINGW32__
4646
#pragma GCC diagnostic push
4747
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
4848
#endif
@@ -114,7 +114,7 @@ void BL2Hook::ftext_as_culture_invariant(unreal::FText* /*text*/,
114114

115115
#pragma endregion
116116

117-
#if defined(__MINGW32__)
117+
#ifdef __MINGW32__
118118
#pragma GCC diagnostic pop
119119
#endif
120120

src/unrealsdk/game/bl2/memory.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace unrealsdk::game {
1313

1414
namespace {
1515

16-
#if defined(__MINGW32__)
16+
#ifdef __MINGW32__
1717
#pragma GCC diagnostic push
1818
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
1919
#endif
@@ -29,7 +29,7 @@ struct FMalloc {
2929
FMallocVFtable* vftable;
3030
};
3131

32-
#if defined(__MINGW32__)
32+
#ifdef __MINGW32__
3333
#pragma GCC diagnostic pop
3434
#endif
3535

src/unrealsdk/game/bl2/object.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ UObject* BL2Hook::construct_object(UClass* cls,
8080

8181
namespace {
8282

83-
#if defined(__MINGW32__)
83+
#ifdef __MINGW32__
8484
#pragma GCC diagnostic push
8585
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
8686
#endif
@@ -90,7 +90,7 @@ typedef void(__thiscall* get_path_name_func)(const UObject* self,
9090
const UObject* stop_outer,
9191
ManagedFString* str);
9292

93-
#if defined(__MINGW32__)
93+
#ifdef __MINGW32__
9494
#pragma GCC diagnostic pop
9595
#endif
9696

src/unrealsdk/game/tps/tps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using namespace unrealsdk::unreal;
99

1010
namespace unrealsdk::game {
1111

12-
#if defined(__MINGW32__)
12+
#ifdef __MINGW32__
1313
#pragma GCC diagnostic push
1414
#pragma GCC diagnostic ignored "-Wattributes" // thiscall on non-class
1515
#endif
@@ -23,7 +23,7 @@ void TPSHook::fname_init(FName* name, const wchar_t* str, int32_t number) const
2323
reinterpret_cast<fname_init_func>(this->fname_init_ptr)(name, str, number, 1, 1, 0);
2424
}
2525

26-
#if defined(__MINGW32__)
26+
#ifdef __MINGW32__
2727
#pragma GCC diagnostic pop
2828
#endif
2929

src/unrealsdk/hook_manager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ std::mutex log_all_calls_stream_mutex{};
137137
void log_all_calls(bool should_log) {
138138
// Only keep this file stream open while we need it
139139
if (should_log) {
140-
const std::lock_guard<std::mutex> lock(log_all_calls_stream_mutex);
140+
const std::scoped_lock lock(log_all_calls_stream_mutex);
141141
log_all_calls_stream.open(
142142
utils::get_this_dll().parent_path()
143143
/ config::get_str("unrealsdk.log_all_calls_file").value_or("unrealsdk.calls.tsv"),
@@ -147,7 +147,7 @@ void log_all_calls(bool should_log) {
147147
should_log_all_calls = should_log;
148148

149149
if (!should_log) {
150-
const std::lock_guard<std::mutex> lock(log_all_calls_stream_mutex);
150+
const std::scoped_lock lock(log_all_calls_stream_mutex);
151151
log_all_calls_stream.close();
152152
}
153153
}
@@ -432,7 +432,7 @@ std::shared_ptr<Node> preprocess_hook(std::wstring_view source,
432432
func_name = func->get_path_name();
433433
auto obj_name = obj->get_path_name();
434434

435-
const std::lock_guard<std::mutex> lock(log_all_calls_stream_mutex);
435+
const std::scoped_lock lock(log_all_calls_stream_mutex);
436436
log_all_calls_stream << source << L'\t' << func_name << L'\t' << obj_name << L'\n';
437437
}
438438
}

0 commit comments

Comments
 (0)