[Lldb-commits] [PATCH] D137900: Make only one function that needs to be implemented when searching for types.
Adrian Prantl via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 1 09:05:39 PST 2022
aprantl added inline comments.
================
Comment at: lldb/include/lldb/Core/Module.h:435
+ /// match: "b::a", "c::b::a", "d::b::a", "e::f::b::a".
+ lldb::TypeSP FindFirstType(ConstString type_name, bool exact_match);
----------------
clayborg wrote:
> aprantl wrote:
> > Why is this not taking a TypeQuery that wraps a name?
> This function doesn't need to exist as long as the "TypeSP TypeQuery::FindFirstType(Module)" function is ok to have around.
It would be good to have some consistency in the interface:
- Either TypeQuery provides Find* methods that take a Module
- or Module provides Find* methods that take a TypeQuery.
Why does this interface exist instead of having a "FindFirstOnly" flag in TypeQuery? Is it because of the overhead of having to dig the type out of a TypeMap?
Otherwise we could just have one method
Module::FindTypes(const TypeQuery &query, TypeResults &results);
that can be called like this
```
module_sp->FindTypes(TypeQuery::createFindFirstByName("name", e_exact_match), result);
TypeSP type = result.GetTypeAtIndex(0); /// better have a special method for this too
```
================
Comment at: lldb/include/lldb/Symbol/Type.h:296
+
+class TypeResults {
+public:
----------------
`/// This is the result of a \ref TypeQuery.`
================
Comment at: lldb/include/lldb/Symbol/Type.h:299
+ /// Construct a type results object
+ TypeResults(bool find_one) : m_find_one(find_one) {}
+
----------------
document what the bool flag does?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137900/new/
https://reviews.llvm.org/D137900
More information about the lldb-commits
mailing list