[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
This commit is contained in:
Michael Buch 2024-01-09 16:02:56 +00:00 committed by GitHub
parent f7cb1afa06
commit 4ea5c603b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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.
///

View File

@ -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<CompilerContext> context_chain) const {
if (GetExactMatch() || context_chain.size() == m_context.size())