|
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" |
@@ -2726,22 +2727,20 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) { |
2726 | 2727 | // Copy our match's context and update the basename we are looking for |
2727 | 2728 | // so we can use this only to compare the context correctly. |
2728 | 2729 | m_index->GetTypesWithQuery(query_simple, [&](DWARFDIE die) { |
2729 | | - if (Type *matching_type = ResolveType(die, true, true)) { |
2730 | | - ConstString name = matching_type->GetQualifiedName(); |
2731 | | - // We have found a type that still might not match due to template |
2732 | | - // parameters. If we create a new TypeQuery that uses the new type's |
2733 | | - // fully qualified name, we can find out if this type matches at all |
2734 | | - // context levels. We can't use just the "match_simple" context |
2735 | | - // because all template parameters were stripped off. The fully |
2736 | | - // qualified name of the type will have the template parameters and |
2737 | | - // will allow us to make sure it matches correctly. |
2738 | | - TypeQuery die_query(name.GetStringRef(), |
2739 | | - TypeQueryOptions::e_exact_match); |
2740 | | - if (!query.ContextMatches(die_query.GetContextRef())) |
2741 | | - return true; // Keep iterating over index types, context mismatch. |
2742 | | - |
2743 | | - results.InsertUnique(matching_type->shared_from_this()); |
| 2730 | + // Check the language, but only if we have a language filter. |
| 2731 | + if (query.HasLanguage()) { |
| 2732 | + if (!query.LanguageMatches(GetLanguageFamily(*die.GetCU()))) |
| 2733 | + return true; // Keep iterating over index types, language mismatch. |
2744 | 2734 | } |
| 2735 | + |
| 2736 | + std::string qualified_name; |
| 2737 | + llvm::raw_string_ostream os(qualified_name); |
| 2738 | + llvm::DWARFTypePrinter<DWARFDIE> type_printer(os); |
| 2739 | + type_printer.appendQualifiedName(die); |
| 2740 | + TypeQuery die_query(qualified_name, e_exact_match); |
| 2741 | + if (query.ContextMatches(die_query.GetContextRef())) |
| 2742 | + if (Type *matching_type = ResolveType(die, true, true)) |
| 2743 | + results.InsertUnique(matching_type->shared_from_this()); |
2745 | 2744 | return !results.Done(query); // Keep iterating if we aren't done. |
2746 | 2745 | }); |
2747 | 2746 | if (results.Done(query)) { |
|
0 commit comments