[Lldb-commits] [lldb] [lldb] Extend FindTypes to optionally search by mangled type name (PR #113007)

via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 18 17:08:20 PDT 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 cc13d4fb4a208363ed1dab29829cd200a3e39c52 eb1f2bbd08d7f50286f0451ce0a6191c71c634eb --extensions cpp,h -- lldb/include/lldb/Symbol/Type.h lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
``````````

</details>

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

``````````diff
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index b90cfc44e9..a8e5b81585 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -84,7 +84,8 @@ FLAGS_ENUM(TypeQueryOptions){
     /// matching type is found. When false, the type query should find all
     /// matching types.
     e_find_one = (1u << 4),
-    // If set, treat TypeQuery::m_name as a mangled name that should be searched.
+    // If set, treat TypeQuery::m_name as a mangled name that should be
+    // searched.
     e_search_by_mangled_name = (1u << 5),
 };
 LLDB_MARK_AS_BITMASK_ENUM(TypeQueryOptions)
@@ -302,8 +303,8 @@ public:
       m_options &= ~e_find_one;
   }
 
-  /// Returns true if the type query is supposed to treat the name to be searched
-  /// as a mangled name.
+  /// Returns true if the type query is supposed to treat the name to be
+  /// searched as a mangled name.
   bool GetSearchByMangledName() const {
     return (m_options & e_search_by_mangled_name) != 0;
   }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
index d4604d72b3..6f7388b3a1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
@@ -385,7 +385,8 @@ static void GetDeclContextImpl(DWARFDIE die, bool use_mangled_name,
       context.push_back({kind, ConstString(name)});
     };
 
-    // Since mangled names are unique there's no need to build an entire context.
+    // Since mangled names are unique there's no need to build an entire
+    // context.
     if (use_mangled_name) {
       push_ctx(CompilerContextKind::AnyType, die.GetMangledName());
       return;
@@ -425,7 +426,8 @@ static void GetDeclContextImpl(DWARFDIE die, bool use_mangled_name,
   }
 }
 
-std::vector<CompilerContext> DWARFDIE::GetDeclContext(bool use_mangled_name) const {
+std::vector<CompilerContext>
+DWARFDIE::GetDeclContext(bool use_mangled_name) const {
   llvm::SmallSet<lldb::user_id_t, 4> seen;
   std::vector<CompilerContext> context;
   GetDeclContextImpl(*this, use_mangled_name, seen, context);
@@ -443,7 +445,8 @@ static void GetTypeLookupContextImpl(DWARFDIE die, bool use_mangled_name,
       context.push_back({kind, ConstString(name)});
     };
 
-    // Since mangled names are unique there's no need to build an entire context.
+    // Since mangled names are unique there's no need to build an entire
+    // context.
     if (use_mangled_name) {
       push_ctx(CompilerContextKind::AnyType, die.GetMangledName());
       return;
@@ -451,7 +454,7 @@ static void GetTypeLookupContextImpl(DWARFDIE die, bool use_mangled_name,
 
     // If there is no name, then there is no need to look anything up for this
     // DIE.
-       const char *name = die.GetName();
+    const char *name = die.GetName();
     if (!name || !name[0])
       return;
 
@@ -474,7 +477,7 @@ static void GetTypeLookupContextImpl(DWARFDIE die, bool use_mangled_name,
       break;
     case DW_TAG_typedef:
       push_ctx(CompilerContextKind::Typedef, die.GetName());
-   break;
+      break;
     case DW_TAG_base_type:
       push_ctx(CompilerContextKind::Builtin, die.GetName());
       break;
@@ -498,7 +501,8 @@ static void GetTypeLookupContextImpl(DWARFDIE die, bool use_mangled_name,
   }
 }
 
-std::vector<CompilerContext> DWARFDIE::GetTypeLookupContext(bool use_mangled_name) const {
+std::vector<CompilerContext>
+DWARFDIE::GetTypeLookupContext(bool use_mangled_name) const {
   llvm::SmallSet<lldb::user_id_t, 4> seen;
   std::vector<CompilerContext> context;
   GetTypeLookupContextImpl(*this, use_mangled_name, seen, context);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
index 109070bdcb..7ecefe616f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
@@ -72,7 +72,8 @@ public:
   /// Return this DIE's decl context as it is needed to look up types
   /// in Clang modules. This context will include any modules or functions that
   /// the type is declared in so an exact module match can be efficiently made.
-  std::vector<CompilerContext> GetDeclContext(bool use_mangled_name = false) const;
+  std::vector<CompilerContext>
+  GetDeclContext(bool use_mangled_name = false) const;
 
   /// Get a context to a type so it can be looked up.
   ///

``````````

</details>


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


More information about the lldb-commits mailing list