DebugNamesDWARFIndex: Add type lookup suport

This implements just one of the GetTypes overloads. The other is not
testable from lldb-test so I'm leaving it unimplemented until I figure
out what to do with testing.

llvm-svn: 334190
This commit is contained in:
Pavel Labath 2018-06-07 12:26:18 +00:00
parent f1c868ef08
commit 6938969223
3 changed files with 21 additions and 1 deletions

View File

@ -17,6 +17,16 @@
// RUN: lldb-test symbols --name=not_there --find=type %t | \
// RUN: FileCheck --check-prefix=EMPTY %s
// RUN: clang %s -g -c -emit-llvm -o - --target=x86_64-pc-linux | \
// RUN: llc -accel-tables=Dwarf -filetype=obj -o %t.o
// RUN: ld.lld %t.o -o %t
// RUN: lldb-test symbols --name=foo --find=type %t | \
// RUN: FileCheck --check-prefix=NAME %s
// RUN: lldb-test symbols --name=foo --context=context --find=type %t | \
// RUN: FileCheck --check-prefix=CONTEXT %s
// RUN: lldb-test symbols --name=not_there --find=type %t | \
// RUN: FileCheck --check-prefix=EMPTY %s
// EMPTY: Found 0 types:
// NAME: Found 4 types:
// CONTEXT: Found 1 types:

View File

@ -98,6 +98,16 @@ void DebugNamesDWARFIndex::GetGlobalVariables(const RegularExpression &regex,
}
}
void DebugNamesDWARFIndex::GetTypes(ConstString name, DIEArray &offsets) {
m_fallback.GetTypes(name, offsets);
for (const DebugNames::Entry &entry :
m_debug_names_up->equal_range(name.GetStringRef())) {
if (isType(entry.tag()))
Append(entry, offsets);
}
}
void DebugNamesDWARFIndex::GetNamespaces(ConstString name, DIEArray &offsets) {
m_fallback.GetNamespaces(name, offsets);

View File

@ -32,7 +32,7 @@ public:
void GetObjCMethods(ConstString class_name, DIEArray &offsets) override {}
void GetCompleteObjCClass(ConstString class_name, bool must_be_implementation,
DIEArray &offsets) override {}
void GetTypes(ConstString name, DIEArray &offsets) override {}
void GetTypes(ConstString name, DIEArray &offsets) override;
void GetTypes(const DWARFDeclContext &context, DIEArray &offsets) override {}
void GetNamespaces(ConstString name, DIEArray &offsets) override;
void GetFunctions(ConstString name, DWARFDebugInfo &info,