[Lldb-commits] [lldb] Fix expressions that involve nested structs/classes/unions. (PR #77029)

via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 4 16:22:00 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 e68a0320a1592bf408ac6458efa2d1c548cfed7a ceb740dcce0ac870b1ef145d41670385a1d24f1c -- lldb/test/API/commands/expression/nested/main.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
``````````

</details>

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

``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 233de2f1ac..4eaeb54b9e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2240,7 +2240,6 @@ bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die,
   for (const DWARFDIE &die : contained_type_dies)
     dwarf->ResolveType(die);
 
-
   return (bool)clang_type;
 }
 
@@ -2269,7 +2268,7 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die,
 
   // Disable external storage for this type so we don't get anymore
   // clang::ExternalASTSource queries for this type.
-  //m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), false);
+  // m_ast.SetHasExternalStorage(clang_type.GetOpaqueQualType(), false);
 
   if (!die)
     return false;
@@ -3117,28 +3116,28 @@ void DWARFASTParserClang::ParseSingleMember(
 
 static bool IsTypeTag(dw_tag_t tag) {
   switch (tag) {
-    case DW_TAG_typedef:
-    case DW_TAG_base_type:
-    case DW_TAG_pointer_type:
-    case DW_TAG_reference_type:
-    case DW_TAG_rvalue_reference_type:
-    case DW_TAG_const_type:
-    case DW_TAG_restrict_type:
-    case DW_TAG_volatile_type:
-    case DW_TAG_atomic_type:
-    case DW_TAG_unspecified_type:
-    case DW_TAG_structure_type:
-    case DW_TAG_union_type:
-    case DW_TAG_class_type:
-    case DW_TAG_enumeration_type:
-    case DW_TAG_inlined_subroutine:
-    case DW_TAG_subprogram:
-    case DW_TAG_subroutine_type:
-    case DW_TAG_array_type:
-    case DW_TAG_ptr_to_member_type:
-      return true;
-    default:
-      break;
+  case DW_TAG_typedef:
+  case DW_TAG_base_type:
+  case DW_TAG_pointer_type:
+  case DW_TAG_reference_type:
+  case DW_TAG_rvalue_reference_type:
+  case DW_TAG_const_type:
+  case DW_TAG_restrict_type:
+  case DW_TAG_volatile_type:
+  case DW_TAG_atomic_type:
+  case DW_TAG_unspecified_type:
+  case DW_TAG_structure_type:
+  case DW_TAG_union_type:
+  case DW_TAG_class_type:
+  case DW_TAG_enumeration_type:
+  case DW_TAG_inlined_subroutine:
+  case DW_TAG_subprogram:
+  case DW_TAG_subroutine_type:
+  case DW_TAG_array_type:
+  case DW_TAG_ptr_to_member_type:
+    return true;
+  default:
+    break;
   }
   return false;
 }
diff --git a/lldb/test/API/commands/expression/nested/main.cpp b/lldb/test/API/commands/expression/nested/main.cpp
index 9f8baaf355..620535fa09 100644
--- a/lldb/test/API/commands/expression/nested/main.cpp
+++ b/lldb/test/API/commands/expression/nested/main.cpp
@@ -1,13 +1,11 @@
 namespace a {
-  namespace b {
-    namespace c {
-      static int d = 12;
-      enum Color {
-        Red, Green, Blue
-      };
-    }
-  }
-}
+namespace b {
+namespace c {
+static int d = 12;
+enum Color { Red, Green, Blue };
+} // namespace c
+} // namespace b
+} // namespace a
 
 struct A {
   int _a = 'a';
@@ -15,9 +13,7 @@ struct A {
     short _b = 'b';
     struct C {
       char _c = 'c';
-      enum EnumType : int {
-        Eleven = 11
-      };
+      enum EnumType : int { Eleven = 11 };
       static EnumType enum_static;
     };
   };

``````````

</details>


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


More information about the lldb-commits mailing list