|
9 | 9 | #include "SymbolFileDWARF.h" |
10 | 10 |
|
11 | 11 | #include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h" |
| 12 | +#include "llvm/DebugInfo/DWARF/DWARFTypePrinter.h" |
12 | 13 | #include "llvm/Support/Casting.h" |
13 | 14 | #include "llvm/Support/FileUtilities.h" |
14 | 15 | #include "llvm/Support/Format.h" |
@@ -2773,22 +2774,20 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) { |
2773 | 2774 | // Copy our match's context and update the basename we are looking for |
2774 | 2775 | // so we can use this only to compare the context correctly. |
2775 | 2776 | m_index->GetTypesWithQuery(query_simple, [&](DWARFDIE die) { |
2776 | | - if (Type *matching_type = ResolveType(die, true, true)) { |
2777 | | - ConstString name = matching_type->GetQualifiedName(); |
2778 | | - // We have found a type that still might not match due to template |
2779 | | - // parameters. If we create a new TypeQuery that uses the new type's |
2780 | | - // fully qualified name, we can find out if this type matches at all |
2781 | | - // context levels. We can't use just the "match_simple" context |
2782 | | - // because all template parameters were stripped off. The fully |
2783 | | - // qualified name of the type will have the template parameters and |
2784 | | - // will allow us to make sure it matches correctly. |
2785 | | - TypeQuery die_query(name.GetStringRef(), |
2786 | | - TypeQueryOptions::e_exact_match); |
2787 | | - if (!query.ContextMatches(die_query.GetContextRef())) |
2788 | | - return true; // Keep iterating over index types, context mismatch. |
2789 | | - |
2790 | | - results.InsertUnique(matching_type->shared_from_this()); |
| 2777 | + // Check the language, but only if we have a language filter. |
| 2778 | + if (query.HasLanguage()) { |
| 2779 | + if (!query.LanguageMatches(GetLanguageFamily(*die.GetCU()))) |
| 2780 | + return true; // Keep iterating over index types, language mismatch. |
2791 | 2781 | } |
| 2782 | + |
| 2783 | + std::string qualified_name; |
| 2784 | + llvm::raw_string_ostream os(qualified_name); |
| 2785 | + llvm::DWARFTypePrinter<DWARFDIE> type_printer(os); |
| 2786 | + type_printer.appendQualifiedName(die); |
| 2787 | + TypeQuery die_query(qualified_name, e_exact_match); |
| 2788 | + if (query.ContextMatches(die_query.GetContextRef())) |
| 2789 | + if (Type *matching_type = ResolveType(die, true, true)) |
| 2790 | + results.InsertUnique(matching_type->shared_from_this()); |
2792 | 2791 | return !results.Done(query); // Keep iterating if we aren't done. |
2793 | 2792 | }); |
2794 | 2793 | if (results.Done(query)) { |
|
0 commit comments