mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
add them to a fast lookup map. lldb_private::Symtab now export the following
public typedefs:
namespace lldb_private {
class Symtab {
typedef std::vector<uint32_t> IndexCollection;
typedef UniqueCStringMap<uint32_t> NameToIndexMap;
};
}
Clients can then find symbols by name and or type and end up with a
Symtab::IndexCollection that is filled with indexes. These indexes can then
be put into a name to index lookup map and control if the mangled and
demangled names get added to the map:
bool add_demangled = true;
bool add_mangled = true;
Symtab::NameToIndexMap name_to_index;
symtab->AppendSymbolNamesToMap (indexes, add_demangled, add_mangled, name_to_index).
This can be repeated as many times as needed to get a lookup table that
you are happy with, and then this can be sorted:
name_to_index.Sort();
Now name lookups can be done using a subset of the symbols you extracted from
the symbol table. This is currently being used to extract objective C types
from object files when there is no debug info in SymbolFileSymtab.
Cleaned up how the objective C types were being vended to be more efficient
and fixed some errors in the regular expression that was being used.
llvm-svn: 145777
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
//===-- ClangExternalASTSourceCommon.cpp ------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
|
|
|
|
using namespace lldb_private;
|
|
|
|
#define ClangExternalASTSourceCommon_MAGIC (0x00112233aabbccddull)
|
|
|
|
ClangExternalASTSourceCommon::ClangExternalASTSourceCommon() : clang::ExternalASTSource()
|
|
{
|
|
m_magic = ClangExternalASTSourceCommon_MAGIC;
|
|
}
|
|
|
|
uint64_t ClangExternalASTSourceCommon::GetMetadata (uintptr_t object)
|
|
{
|
|
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
|
|
|
|
return m_metadata[object];
|
|
}
|
|
|
|
void ClangExternalASTSourceCommon::SetMetadata (uintptr_t object, uint64_t metadata)
|
|
{
|
|
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
|
|
|
|
m_metadata[object] = metadata;
|
|
}
|
|
|
|
bool ClangExternalASTSourceCommon::HasMetadata (uintptr_t object)
|
|
{
|
|
assert (m_magic == ClangExternalASTSourceCommon_MAGIC);
|
|
|
|
return m_metadata.find(object) != m_metadata.end();
|
|
}
|