Kernel: Resolve clang-tidy readability-qualified-auto warning

... In files included by Kernel/Process.cpp or Kernel/Thread.cpp
This commit is contained in:
Andrew Kaster 2021-10-31 16:36:52 -06:00 committed by Andreas Kling
parent 65edc62c02
commit e824bead54
Notes: sideshowbarker 2024-07-18 01:07:16 +09:00
4 changed files with 12 additions and 12 deletions

View file

@ -135,7 +135,7 @@ public:
auto expected_wakeup = last_wakeup + ideal_interval; auto expected_wakeup = last_wakeup + ideal_interval;
auto delay = (now > expected_wakeup) ? now - expected_wakeup : Time::from_microseconds(0); auto delay = (now > expected_wakeup) ? now - expected_wakeup : Time::from_microseconds(0);
last_wakeup = now; last_wakeup = now;
auto current_thread = Thread::current(); auto* current_thread = Thread::current();
// FIXME: We currently don't collect samples while idle. // FIXME: We currently don't collect samples while idle.
// That will be an interesting mode to add in the future. :^) // That will be an interesting mode to add in the future. :^)
if (!current_thread || current_thread == Processor::idle_thread()) if (!current_thread || current_thread == Processor::idle_thread())

View file

@ -102,7 +102,7 @@ void Process::kill_threads_except_self()
if (thread_count() <= 1) if (thread_count() <= 1)
return; return;
auto current_thread = Thread::current(); auto* current_thread = Thread::current();
for_each_thread([&](Thread& thread) { for_each_thread([&](Thread& thread) {
if (&thread == current_thread) if (&thread == current_thread)
return; return;
@ -378,7 +378,7 @@ void Process::crash(int signal, FlatPtr ip, bool out_of_memory)
dbgln("\033[31;1mOut of memory\033[m, killing: {}", *this); dbgln("\033[31;1mOut of memory\033[m, killing: {}", *this);
} else { } else {
if (ip >= kernel_load_base && g_kernel_symbols_available) { if (ip >= kernel_load_base && g_kernel_symbols_available) {
auto* symbol = symbolicate_kernel_address(ip); auto const* symbol = symbolicate_kernel_address(ip);
dbgln("\033[31;1m{:p} {} +{}\033[0m\n", ip, (symbol ? symbol->name : "(k?)"), (symbol ? ip - symbol->address : 0)); dbgln("\033[31;1m{:p} {} +{}\033[0m\n", ip, (symbol ? symbol->name : "(k?)"), (symbol ? ip - symbol->address : 0));
} else { } else {
dbgln("\033[31;1m{:p} (?)\033[0m\n", ip); dbgln("\033[31;1m{:p} (?)\033[0m\n", ip);
@ -402,7 +402,7 @@ void Process::crash(int signal, FlatPtr ip, bool out_of_memory)
RefPtr<Process> Process::from_pid(ProcessID pid) RefPtr<Process> Process::from_pid(ProcessID pid)
{ {
return processes().with([&](const auto& list) -> RefPtr<Process> { return processes().with([&](const auto& list) -> RefPtr<Process> {
for (auto& process : list) { for (auto const& process : list) {
if (process.pid() == pid) if (process.pid() == pid)
return &process; return &process;
} }
@ -416,7 +416,7 @@ const Process::OpenFileDescriptionAndFlags* Process::OpenFileDescriptions::get_i
if (m_fds_metadatas.size() <= i) if (m_fds_metadatas.size() <= i)
return nullptr; return nullptr;
if (auto& metadata = m_fds_metadatas[i]; metadata.is_valid()) if (auto const& metadata = m_fds_metadatas[i]; metadata.is_valid())
return &metadata; return &metadata;
return nullptr; return nullptr;
@ -462,7 +462,7 @@ ErrorOr<NonnullRefPtr<OpenFileDescription>> Process::OpenFileDescriptions::open_
void Process::OpenFileDescriptions::enumerate(Function<void(const OpenFileDescriptionAndFlags&)> callback) const void Process::OpenFileDescriptions::enumerate(Function<void(const OpenFileDescriptionAndFlags&)> callback) const
{ {
SpinlockLocker lock(m_fds_lock); SpinlockLocker lock(m_fds_lock);
for (auto& file_description_metadata : m_fds_metadatas) { for (auto const& file_description_metadata : m_fds_metadatas) {
callback(file_description_metadata); callback(file_description_metadata);
} }
} }

View file

@ -148,7 +148,7 @@ public:
inline static Process& current() inline static Process& current()
{ {
auto current_thread = Processor::current_thread(); auto* current_thread = Processor::current_thread();
VERIFY(current_thread); VERIFY(current_thread);
return current_thread->process(); return current_thread->process();
} }
@ -489,7 +489,7 @@ public:
template<typename Callback> template<typename Callback>
void for_each_coredump_property(Callback callback) const void for_each_coredump_property(Callback callback) const
{ {
for (auto& property : m_coredump_properties) { for (auto const& property : m_coredump_properties) {
if (property.key && property.value) if (property.key && property.value)
callback(*property.key, *property.value); callback(*property.key, *property.value);
} }

View file

@ -178,7 +178,7 @@ void Thread::block(Kernel::Mutex& lock, SpinlockLocker<Spinlock>& lock_lock, u32
auto& big_lock = process().big_lock(); auto& big_lock = process().big_lock();
VERIFY((&lock == &big_lock && m_blocking_lock != &big_lock) || !m_blocking_lock); VERIFY((&lock == &big_lock && m_blocking_lock != &big_lock) || !m_blocking_lock);
auto previous_blocking_lock = m_blocking_lock; auto* previous_blocking_lock = m_blocking_lock;
m_blocking_lock = &lock; m_blocking_lock = &lock;
m_lock_requested_count = lock_count; m_lock_requested_count = lock_count;
@ -789,7 +789,7 @@ static DefaultSignalAction default_signal_action(u8 signal)
bool Thread::should_ignore_signal(u8 signal) const bool Thread::should_ignore_signal(u8 signal) const
{ {
VERIFY(signal < 32); VERIFY(signal < 32);
auto& action = m_signal_action_data[signal]; auto const& action = m_signal_action_data[signal];
if (action.handler_or_sigaction.is_null()) if (action.handler_or_sigaction.is_null())
return default_signal_action(signal) == DefaultSignalAction::Ignore; return default_signal_action(signal) == DefaultSignalAction::Ignore;
if ((sighandler_t)action.handler_or_sigaction.get() == SIG_IGN) if ((sighandler_t)action.handler_or_sigaction.get() == SIG_IGN)
@ -800,7 +800,7 @@ bool Thread::should_ignore_signal(u8 signal) const
bool Thread::has_signal_handler(u8 signal) const bool Thread::has_signal_handler(u8 signal) const
{ {
VERIFY(signal < 32); VERIFY(signal < 32);
auto& action = m_signal_action_data[signal]; auto const& action = m_signal_action_data[signal];
return !action.handler_or_sigaction.is_null(); return !action.handler_or_sigaction.is_null();
} }
@ -859,7 +859,7 @@ DispatchSignalResult Thread::dispatch_signal(u8 signal)
m_have_any_unmasked_pending_signals.store((m_pending_signals & ~m_signal_mask) != 0, AK::memory_order_release); m_have_any_unmasked_pending_signals.store((m_pending_signals & ~m_signal_mask) != 0, AK::memory_order_release);
auto& process = this->process(); auto& process = this->process();
auto tracer = process.tracer(); auto* tracer = process.tracer();
if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) { if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) {
dbgln_if(SIGNAL_DEBUG, "Signal {} stopping this thread", signal); dbgln_if(SIGNAL_DEBUG, "Signal {} stopping this thread", signal);
set_state(State::Stopped, signal); set_state(State::Stopped, signal);