[Lldb-commits] [lldb] Make only one function that needs to be implemented when searching for types (PR #74786)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 11 10:54:21 PST 2023
================
@@ -64,6 +64,125 @@ bool lldb_private::contextMatches(llvm::ArrayRef<CompilerContext> context_chain,
return true;
}
+static CompilerContextKind ConvertTypeClass(lldb::TypeClass type_class) {
+ if (type_class == eTypeClassAny)
+ return CompilerContextKind::AnyType;
+ uint16_t result = 0;
+ if (type_class & lldb::eTypeClassClass)
+ result |= (uint16_t)CompilerContextKind::Class;
+ if (type_class & lldb::eTypeClassStruct)
+ result |= (uint16_t)CompilerContextKind::Struct;
+ if (type_class & lldb::eTypeClassUnion)
+ result |= (uint16_t)CompilerContextKind::Union;
+ if (type_class & lldb::eTypeClassEnumeration)
+ result |= (uint16_t)CompilerContextKind::Enum;
+ if (type_class & lldb::eTypeClassFunction)
+ result |= (uint16_t)CompilerContextKind::Function;
+ if (type_class & lldb::eTypeClassTypedef)
+ result |= (uint16_t)CompilerContextKind::Typedef;
+ return (CompilerContextKind)result;
+}
+
+TypeQuery::TypeQuery(llvm::StringRef name, TypeQueryOptions options)
+ : m_options(options) {
+ llvm::StringRef scope, basename;
+ lldb::TypeClass type_class = lldb::eTypeClassAny;
+ if (Type::GetTypeScopeAndBasename(name, scope, basename, type_class)) {
+ if (scope.consume_front("::"))
+ m_options |= e_exact_match;
+ if (!scope.empty()) {
+ std::pair<llvm::StringRef, llvm::StringRef> scope_pair =
----------------
Michael137 wrote:
don't need to block the PR on this, but wouldn't using the `split(SmallVector<StringRef> &)` overload make this whole block simpler?
https://github.com/llvm/llvm-project/pull/74786
More information about the lldb-commits
mailing list