[Lldb-commits] [lldb] Ensure that the executable module is ModuleList[0] (PR #78360)

via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 16 14:45:29 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 32dd5b20973bde1ef77fa3b84b9f85788a1a303a 4d53ea53a9a5d9344d41195697b3b98359af1ede -- lldb/test/API/functionalities/executable_first/b.cpp lldb/test/API/functionalities/executable_first/main.cpp lldb/source/Core/ModuleList.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 80299f80a2..a5f8624b11 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -212,8 +212,8 @@ void ModuleList::AppendImpl(const ModuleSP &module_sp, bool use_notifier) {
   if (module_sp) {
     std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
     // We are required to keep the first element of the Module List as the
-    // executable module.  So check here and if the first module is NOT an 
-    // but the new one is, we insert this module at the beginning, rather than 
+    // executable module.  So check here and if the first module is NOT an
+    // but the new one is, we insert this module at the beginning, rather than
     // at the end.
     // We don't need to do any of this if the list is empty:
     if (m_modules.empty()) {
@@ -222,13 +222,13 @@ void ModuleList::AppendImpl(const ModuleSP &module_sp, bool use_notifier) {
       // Since producing the ObjectFile may take some work, first check the 0th
       // element, and only if that's NOT an executable look at the incoming
       // ObjectFile.  That way in the normal case we only look at the element
-      // 0 ObjectFile. 
-      const bool elem_zero_is_executable 
-          = m_modules[0]->GetObjectFile()->GetType() 
-              == ObjectFile::Type::eTypeExecutable;
+      // 0 ObjectFile.
+      const bool elem_zero_is_executable =
+          m_modules[0]->GetObjectFile()->GetType() ==
+          ObjectFile::Type::eTypeExecutable;
       lldb_private::ObjectFile *obj = module_sp->GetObjectFile();
-      if (!elem_zero_is_executable && obj 
-          && obj->GetType() == ObjectFile::Type::eTypeExecutable) {
+      if (!elem_zero_is_executable && obj &&
+          obj->GetType() == ObjectFile::Type::eTypeExecutable) {
         m_modules.insert(m_modules.begin(), module_sp);
       } else {
         m_modules.push_back(module_sp);
diff --git a/lldb/test/API/functionalities/executable_first/main.cpp b/lldb/test/API/functionalities/executable_first/main.cpp
index ba61bf837b..e154a01d2d 100644
--- a/lldb/test/API/functionalities/executable_first/main.cpp
+++ b/lldb/test/API/functionalities/executable_first/main.cpp
@@ -1,6 +1,6 @@
 extern int b_function();
 
-int main(int argc, char* argv[]) {
+int main(int argc, char *argv[]) {
   int ret_value = b_function();
   return ret_value; // break after function call
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/78360


More information about the lldb-commits mailing list