Skip to content

Commit

Permalink
[lldb][Type] Add TypeQuery::SetLanguages API (llvm#75926)
Browse files Browse the repository at this point in the history
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: swiftlang#7885
  • Loading branch information
Michael137 authored Jan 9, 2024
1 parent f7cb1af commit 4ea5c60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lldb/include/lldb/Symbol/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ class TypeQuery {
/// 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.
///
Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Symbol/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 4ea5c60

Please sign in to comment.