aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2024-01-09 16:02:56 +0000
committerGitHub <noreply@github.com>2024-01-09 16:02:56 +0000
commit4ea5c603b4c4db36b8ee7e04adf96416f4d996dc (patch)
tree2269b883d4c56a35639ad9574c41cdbb47f61fde
parentf7cb1afa06335edfc043cb5f11f97907e9df844c (diff)
downloadllvm-4ea5c603b4c4db36b8ee7e04adf96416f4d996dc.zip
llvm-4ea5c603b4c4db36b8ee7e04adf96416f4d996dc.tar.gz
llvm-4ea5c603b4c4db36b8ee7e04adf96416f4d996dc.tar.bz2
[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
-rw-r--r--lldb/include/lldb/Symbol/Type.h4
-rw-r--r--lldb/source/Symbol/Type.cpp4
2 files changed, 8 insertions, 0 deletions
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<CompilerContext> context_chain) const {
if (GetExactMatch() || context_chain.size() == m_context.size())