[Lldb-commits] [lldb] [lldb][[DWARFDeclContext] Add function to extract qualified names as vector (PR #77349)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 9 11:25:14 PST 2024


================
@@ -68,6 +68,11 @@ class DWARFDeclContext {
 
   const char *GetQualifiedName() const;
 
+  /// Returns a vector of string, one string per entry in the fully qualified
+  /// name. For example, for the DeclContext `A::B::C`, this methods returns
+  /// `{"C", "B", "A"}`
+  llvm::SmallVector<llvm::StringRef> GetQualifiedNameAsVector() const;
----------------
clayborg wrote:

One idea would be to get rid of `DWARFDeclContext` and just use `std::vector<CompilerContext>` everywhere. 

We could make a using directive for `std::vector<CompilerContext>` so we don't have to mention the std::vector all of the time :
```
using CompilerDeclContext= std::vector<CompilerContext>;
```
Then we could actually get rid of `DWARFDeclContext` and just use `CompilerDeclContext` everywhere, as it really contains very similar kind of stuff, it is just more DWARF specific. We already make `ConstString` objects for each DIE's name anyway and the comparing many matching entries becomes a pointer compare for the string instead of actual string comparisons.

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


More information about the lldb-commits mailing list