Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb][Type] Add TypeQuery::SetLanguages API #75926

Merged
merged 1 commit into from Jan 9, 2024

Conversation

Michael137
Copy link
Member

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: apple#7885

This is required for users of `TypeQuery` that limit
the set of languages of the query using APIs such as
`GetSupportedLanguagesForTypes` or
`GetSupportedLanguagesForExpressions`.
@llvmbot
Copy link
Collaborator

llvmbot commented Dec 19, 2023

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

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: apple#7885


Full diff: https://github.com/llvm/llvm-project/pull/75926.diff

2 Files Affected:

  • (modified) lldb/include/lldb/Symbol/Type.h (+4)
  • (modified) lldb/source/Symbol/Type.cpp (+4)
diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h
index 307be6c55e0161..acd1a769f13cd6 100644
--- a/lldb/include/lldb/Symbol/Type.h
+++ b/lldb/include/lldb/Symbol/Type.h
@@ -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.
   ///
diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp
index 293fe1b78f4a54..6069d066eaf66b 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())

@Michael137
Copy link
Member Author

Trying to add tests for this in SymbolFileDWARFTests

@Michael137 Michael137 merged commit 4ea5c60 into llvm:main Jan 9, 2024
5 checks passed
@Michael137 Michael137 deleted the lldb/type-query-language-apis branch January 9, 2024 16:03
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
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: apple#7885
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants