[Lldb-commits] [lldb] [lldb][Type] Add TypeQuery::SetLanguages API (PR #75926)

via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 19 04:33:09 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

<details>
<summary>Changes</summary>

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

---
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
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())

``````````

</details>


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


More information about the lldb-commits mailing list