Summary: UniqueCStringMap "sorts" the entries for fast lookup, but really it only cares about uniqueness. ConstString can be compared by pointer alone, rather than with strcmp, resulting in much faster comparisons. Change the interface to take ConstString instead, and propagate use of the type to the callers where appropriate. Reviewers: #lldb, clayborg Reviewed By: clayborg Subscribers: labath, jasonmolenda, lldb-commits Differential Revision: https://reviews.llvm.org/D32316 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 301908
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
//===-- NameToDIE.h ---------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SymbolFileDWARF_NameToDIE_h_
|
|
#define SymbolFileDWARF_NameToDIE_h_
|
|
|
|
#include <functional>
|
|
|
|
#include "DIERef.h"
|
|
#include "lldb/Core/UniqueCStringMap.h"
|
|
#include "lldb/Core/dwarf.h"
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
class SymbolFileDWARF;
|
|
|
|
class NameToDIE {
|
|
public:
|
|
NameToDIE() : m_map() {}
|
|
|
|
~NameToDIE() {}
|
|
|
|
void Dump(lldb_private::Stream *s);
|
|
|
|
void Insert(const lldb_private::ConstString &name, const DIERef &die_ref);
|
|
|
|
void Append(const NameToDIE &other);
|
|
|
|
void Finalize();
|
|
|
|
size_t Find(const lldb_private::ConstString &name,
|
|
DIEArray &info_array) const;
|
|
|
|
size_t Find(const lldb_private::RegularExpression ®ex,
|
|
DIEArray &info_array) const;
|
|
|
|
size_t FindAllEntriesForCompileUnit(dw_offset_t cu_offset,
|
|
DIEArray &info_array) const;
|
|
|
|
void
|
|
ForEach(std::function<bool(lldb_private::ConstString name,
|
|
const DIERef &die_ref)> const
|
|
&callback) const;
|
|
|
|
protected:
|
|
lldb_private::UniqueCStringMap<DIERef> m_map;
|
|
};
|
|
|
|
#endif // SymbolFileDWARF_NameToDIE_h_
|