ソースを参照

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

... In files included by Kernel/Process.cpp or Kernel/Thread.cpp
Andrew Kaster 3 年 前
コミット
e824bead54
4 ファイル変更12 行追加12 行削除
  1. 1 1
      Kernel/PerformanceManager.h
  2. 5 5
      Kernel/Process.cpp
  3. 2 2
      Kernel/Process.h
  4. 4 4
      Kernel/Thread.cpp

+ 1 - 1
Kernel/PerformanceManager.h

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

+ 5 - 5
Kernel/Process.cpp

@@ -102,7 +102,7 @@ void Process::kill_threads_except_self()
     if (thread_count() <= 1)
         return;
 
-    auto current_thread = Thread::current();
+    auto* current_thread = Thread::current();
     for_each_thread([&](Thread& thread) {
         if (&thread == current_thread)
             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);
     } else {
         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));
         } else {
             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)
 {
     return processes().with([&](const auto& list) -> RefPtr<Process> {
-        for (auto& process : list) {
+        for (auto const& process : list) {
             if (process.pid() == pid)
                 return &process;
         }
@@ -416,7 +416,7 @@ const Process::OpenFileDescriptionAndFlags* Process::OpenFileDescriptions::get_i
     if (m_fds_metadatas.size() <= i)
         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 nullptr;
@@ -462,7 +462,7 @@ ErrorOr<NonnullRefPtr<OpenFileDescription>> Process::OpenFileDescriptions::open_
 void Process::OpenFileDescriptions::enumerate(Function<void(const OpenFileDescriptionAndFlags&)> callback) const
 {
     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);
     }
 }

+ 2 - 2
Kernel/Process.h

@@ -148,7 +148,7 @@ public:
 
     inline static Process& current()
     {
-        auto current_thread = Processor::current_thread();
+        auto* current_thread = Processor::current_thread();
         VERIFY(current_thread);
         return current_thread->process();
     }
@@ -489,7 +489,7 @@ public:
     template<typename Callback>
     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)
                 callback(*property.key, *property.value);
         }

+ 4 - 4
Kernel/Thread.cpp

@@ -178,7 +178,7 @@ void Thread::block(Kernel::Mutex& lock, SpinlockLocker<Spinlock>& lock_lock, u32
     auto& big_lock = process().big_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_lock_requested_count = lock_count;
 
@@ -789,7 +789,7 @@ static DefaultSignalAction default_signal_action(u8 signal)
 bool Thread::should_ignore_signal(u8 signal) const
 {
     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())
         return default_signal_action(signal) == DefaultSignalAction::Ignore;
     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
 {
     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();
 }
 
@@ -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);
 
     auto& process = this->process();
-    auto tracer = process.tracer();
+    auto* tracer = process.tracer();
     if (signal == SIGSTOP || (tracer && default_signal_action(signal) == DefaultSignalAction::DumpCore)) {
         dbgln_if(SIGNAL_DEBUG, "Signal {} stopping this thread", signal);
         set_state(State::Stopped, signal);