From 4ea5c603b4c4db36b8ee7e04adf96416f4d996dc Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 9 Jan 2024 16:02:56 +0000 Subject: [lldb][Type] Add TypeQuery::SetLanguages API (#75926) This is required for users of `TypeQuery` that limit the set of languages of the query using APIs such as `GetSupportedLanguagesForTypes` or `GetSupportedLanguagesForExpressions`. Example usage: https://github.com/apple/llvm-project/pull/7885 --- lldb/include/lldb/Symbol/Type.h | 4 ++++ lldb/source/Symbol/Type.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 307be6c..acd1a76 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -247,6 +247,10 @@ public: /// match. void AddLanguage(lldb::LanguageType language); + /// Set the list of languages that should produce a match to only the ones + /// specified in \ref languages. + void SetLanguages(LanguageSet languages); + /// Check if the language matches any languages that have been added to this /// match object. /// diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 293fe1b..6069d06 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -145,6 +145,10 @@ void TypeQuery::AddLanguage(LanguageType language) { m_languages->Insert(language); } +void TypeQuery::SetLanguages(LanguageSet languages) { + m_languages = std::move(languages); +} + bool TypeQuery::ContextMatches( llvm::ArrayRef context_chain) const { if (GetExactMatch() || context_chain.size() == m_context.size()) -- cgit v1.1