Skip to content

Commit ae672ed

Browse files
committed
Another case of string comparison rather than AST comparison
1 parent ff1d538 commit ae672ed

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#include "lldb/Interpreter/OptionValueFileSpecList.h"
3939
#include "lldb/Interpreter/OptionValueProperties.h"
4040

41+
#include "llvm/DebugInfo/DWARF/DWARFTypePrinter.h"
42+
4143
#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
4244
#include "Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h"
4345
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
@@ -2785,33 +2787,15 @@ void SymbolFileDWARF::FindTypes(const TypeQuery &query, TypeResults &results) {
27852787
return true; // Keep iterating over index types, language mismatch.
27862788
}
27872789

2788-
// Check the context matches
2789-
std::vector<lldb_private::CompilerContext> die_context;
2790-
if (query.GetModuleSearch())
2791-
die_context = die.GetDeclContext();
2792-
else
2793-
die_context = die.GetTypeLookupContext();
2794-
assert(!die_context.empty());
2795-
if (!query_simple.ContextMatches(die_context))
2796-
return true; // Keep iterating over index types, context mismatch.
2797-
2798-
// Try to resolve the type.
2799-
if (Type *matching_type = ResolveType(die, true, true)) {
2800-
ConstString name = matching_type->GetQualifiedName();
2801-
// We have found a type that still might not match due to template
2802-
// parameters. If we create a new TypeQuery that uses the new type's
2803-
// fully qualified name, we can find out if this type matches at all
2804-
// context levels. We can't use just the "match_simple" context
2805-
// because all template parameters were stripped off. The fully
2806-
// qualified name of the type will have the template parameters and
2807-
// will allow us to make sure it matches correctly.
2808-
TypeQuery die_query(name.GetStringRef(),
2809-
TypeQueryOptions::e_exact_match);
2810-
if (!query.ContextMatches(die_query.GetContextRef()))
2811-
return true; // Keep iterating over index types, context mismatch.
2812-
2813-
results.InsertUnique(matching_type->shared_from_this());
2814-
}
2790+
std::string R;
2791+
llvm::raw_string_ostream OS(R);
2792+
llvm::DWARFTypePrinter<DWARFDIE> p(OS);
2793+
p.appendQualifiedName(die);
2794+
2795+
TypeQuery die_query(R, TypeQueryOptions::e_exact_match);
2796+
if (query.ContextMatches(die_query.GetContextRef()))
2797+
if (Type *matching_type = ResolveType(die, true, true))
2798+
results.InsertUnique(matching_type->shared_from_this());
28152799
return !results.Done(query); // Keep iterating if we aren't done.
28162800
});
28172801
if (results.Done(query))

0 commit comments

Comments
 (0)