mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
[lldb] Eliminate namespace lldb_private::dwarf (NFC) (#150073)
Eliminate the `lldb_private::dwarf` namespace, in favor of using `llvm::dwarf` directly. The latter is shorter, and this avoids ambiguity in the ABI plugins that define a `dwarf` namespace inside an anonymous namespace.
This commit is contained in:
committed by
GitHub
parent
dbd9eae95a
commit
2cb1ecb94b
@@ -14,12 +14,6 @@
|
||||
// Get the DWARF constant definitions from llvm
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
|
||||
namespace lldb_private {
|
||||
namespace dwarf {
|
||||
using namespace llvm::dwarf;
|
||||
}
|
||||
}
|
||||
|
||||
typedef llvm::dwarf::Attribute dw_attr_t;
|
||||
typedef llvm::dwarf::Form dw_form_t;
|
||||
typedef llvm::dwarf::Tag dw_tag_t;
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
// DWARFExpression constructor
|
||||
DWARFExpression::DWARFExpression() : m_data() {}
|
||||
|
||||
@@ -848,7 +848,7 @@ static DWARFExpression CreateDWARFExpression(ModuleSP module_sp,
|
||||
uint32_t byte_size = architecture.GetDataByteSize();
|
||||
|
||||
StreamBuffer<32> stream(Stream::eBinary, address_size, byte_order);
|
||||
stream.PutHex8(lldb_private::dwarf::DW_OP_addr);
|
||||
stream.PutHex8(llvm::dwarf::DW_OP_addr);
|
||||
stream.PutMaxHex64(symbol.GetFileAddress(), address_size, byte_order);
|
||||
|
||||
DataBufferSP buffer =
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include "lldb/Symbol/Function.h"
|
||||
#include "llvm/Support/DJB.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
std::unique_ptr<AppleDWARFIndex> AppleDWARFIndex::Create(
|
||||
Module &module, DWARFDataExtractor apple_names,
|
||||
@@ -80,7 +80,7 @@ static bool
|
||||
EntryHasMatchingQualhash(const llvm::AppleAcceleratorTable::Entry &entry,
|
||||
uint32_t expected_hash) {
|
||||
std::optional<llvm::DWARFFormValue> form_value =
|
||||
entry.lookup(dwarf::DW_ATOM_qual_name_hash);
|
||||
entry.lookup(llvm::dwarf::DW_ATOM_qual_name_hash);
|
||||
if (!form_value)
|
||||
return false;
|
||||
std::optional<uint64_t> hash = form_value->getAsUnsignedConstant();
|
||||
@@ -93,7 +93,7 @@ EntryHasMatchingQualhash(const llvm::AppleAcceleratorTable::Entry &entry,
|
||||
static bool EntryHasMatchingTag(const llvm::AppleAcceleratorTable::Entry &entry,
|
||||
dw_tag_t expected_tag) {
|
||||
std::optional<llvm::DWARFFormValue> form_value =
|
||||
entry.lookup(dwarf::DW_ATOM_die_tag);
|
||||
entry.lookup(llvm::dwarf::DW_ATOM_die_tag);
|
||||
if (!form_value)
|
||||
return false;
|
||||
std::optional<uint64_t> maybe_tag = form_value->getAsUnsignedConstant();
|
||||
@@ -109,7 +109,7 @@ static bool EntryHasMatchingTag(const llvm::AppleAcceleratorTable::Entry &entry,
|
||||
static bool
|
||||
HasImplementationFlag(const llvm::AppleAcceleratorTable::Entry &entry) {
|
||||
std::optional<llvm::DWARFFormValue> form_value =
|
||||
entry.lookup(dwarf::DW_ATOM_type_flags);
|
||||
entry.lookup(llvm::dwarf::DW_ATOM_type_flags);
|
||||
if (!form_value)
|
||||
return false;
|
||||
std::optional<uint64_t> Flags = form_value->getAsUnsignedConstant();
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
std::optional<SymbolFile::ArrayInfo>
|
||||
DWARFASTParser::ParseChildArrayInfo(const DWARFDIE &parent_die,
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast)
|
||||
: DWARFASTParser(Kind::DWARFASTParserClang), m_ast(ast),
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "DWARFUnit.h"
|
||||
#include "DWARFDebugInfo.h"
|
||||
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
|
||||
DWARFAttributes::DWARFAttributes() : m_infos() {}
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ void DWARFDebugInfo::ParseUnitsFor(DIERef::Section section) {
|
||||
// table lookups can cause the DWO files to be accessed before the skeleton
|
||||
// compile unit is parsed, so we keep a map to allow us to match up the DWO
|
||||
// file to the back to the skeleton compile units.
|
||||
if (unit_sp->GetUnitType() == lldb_private::dwarf::DW_UT_skeleton) {
|
||||
if (unit_sp->GetUnitType() == llvm::dwarf::DW_UT_skeleton) {
|
||||
if (std::optional<uint64_t> unit_dwo_id = unit_sp->GetHeaderDWOId())
|
||||
m_dwarf5_dwo_id_to_skeleton_unit[*unit_dwo_id] = unit_sp.get();
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#include "SymbolFileDWARFDwo.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
extern int g_verbose;
|
||||
|
||||
// Extract a debug info entry for a given DWARFUnit from the data
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "DWARFDataExtractor.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
DWARFDebugMacroHeader
|
||||
DWARFDebugMacroHeader::ParseHeader(const DWARFDataExtractor &debug_macro_data,
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "DWARFDeclContext.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
const char *DWARFDeclContext::Entry::GetName() const {
|
||||
if (name != nullptr)
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include "DWARFUnit.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
void DWARFFormValue::Clear() {
|
||||
m_unit = nullptr;
|
||||
@@ -564,25 +564,25 @@ uint64_t DWARFFormValue::Reference(dw_offset_t base_offset) const {
|
||||
}
|
||||
|
||||
std::optional<uint64_t> DWARFFormValue::getAsUnsignedConstant() const {
|
||||
if ((!IsDataForm(m_form)) || m_form == lldb_private::dwarf::DW_FORM_sdata)
|
||||
if ((!IsDataForm(m_form)) || m_form == llvm::dwarf::DW_FORM_sdata)
|
||||
return std::nullopt;
|
||||
return m_value.uval;
|
||||
}
|
||||
|
||||
std::optional<int64_t> DWARFFormValue::getAsSignedConstant() const {
|
||||
if ((!IsDataForm(m_form)) ||
|
||||
(m_form == lldb_private::dwarf::DW_FORM_udata &&
|
||||
(m_form == llvm::dwarf::DW_FORM_udata &&
|
||||
uint64_t(std::numeric_limits<int64_t>::max()) < m_value.uval))
|
||||
return std::nullopt;
|
||||
switch (m_form) {
|
||||
case lldb_private::dwarf::DW_FORM_data4:
|
||||
case llvm::dwarf::DW_FORM_data4:
|
||||
return int32_t(m_value.uval);
|
||||
case lldb_private::dwarf::DW_FORM_data2:
|
||||
case llvm::dwarf::DW_FORM_data2:
|
||||
return int16_t(m_value.uval);
|
||||
case lldb_private::dwarf::DW_FORM_data1:
|
||||
case llvm::dwarf::DW_FORM_data1:
|
||||
return int8_t(m_value.uval);
|
||||
case lldb_private::dwarf::DW_FORM_sdata:
|
||||
case lldb_private::dwarf::DW_FORM_data8:
|
||||
case llvm::dwarf::DW_FORM_sdata:
|
||||
case llvm::dwarf::DW_FORM_data8:
|
||||
default:
|
||||
return m_value.sval;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
extern int g_verbose;
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
#include "llvm/ADT/Sequence.h"
|
||||
#include <optional>
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
llvm::Expected<std::unique_ptr<DebugNamesDWARFIndex>>
|
||||
DebugNamesDWARFIndex::Create(Module &module, DWARFDataExtractor debug_names,
|
||||
@@ -484,7 +484,7 @@ void DebugNamesDWARFIndex::GetNamespaces(
|
||||
ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
|
||||
for (const DebugNames::Entry &entry :
|
||||
m_debug_names_up->equal_range(name.GetStringRef())) {
|
||||
lldb_private::dwarf::Tag entry_tag = entry.tag();
|
||||
llvm::dwarf::Tag entry_tag = entry.tag();
|
||||
if (entry_tag == DW_TAG_namespace ||
|
||||
entry_tag == DW_TAG_imported_declaration) {
|
||||
if (!ProcessEntry(entry, callback))
|
||||
@@ -574,7 +574,7 @@ void DebugNamesDWARFIndex::GetNamespacesWithParents(
|
||||
[](const CompilerContext &ctx) { return !ctx.name.IsEmpty(); });
|
||||
for (const DebugNames::Entry &entry :
|
||||
m_debug_names_up->equal_range(name.GetStringRef())) {
|
||||
lldb_private::dwarf::Tag entry_tag = entry.tag();
|
||||
llvm::dwarf::Tag entry_tag = entry.tag();
|
||||
if (entry_tag == DW_TAG_namespace ||
|
||||
entry_tag == DW_TAG_imported_declaration) {
|
||||
std::optional<llvm::SmallVector<Entry, 4>> parent_chain =
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
void ManualDWARFIndex::Index() {
|
||||
if (m_indexed)
|
||||
|
||||
@@ -98,8 +98,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
LLDB_PLUGIN_DEFINE(SymbolFileDWARF)
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
#include "lldb/Core/Declaration.h"
|
||||
#include "lldb/Target/Language.h"
|
||||
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
static bool IsStructOrClassTag(llvm::dwarf::Tag Tag) {
|
||||
return Tag == llvm::dwarf::Tag::DW_TAG_class_type ||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::npdb;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
using namespace llvm::pdb;
|
||||
|
||||
static std::unique_ptr<IPDBFrameData>
|
||||
|
||||
@@ -87,8 +87,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
using namespace clang;
|
||||
using llvm::StringSwitch;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
// GetDwarfEHPtr
|
||||
//
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::postfix;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
static std::optional<BinaryOpNode::OpType>
|
||||
GetBinaryOpType(llvm::StringRef token) {
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
static llvm::Expected<Scalar> Evaluate(llvm::ArrayRef<uint8_t> expr,
|
||||
lldb::ModuleSP module_sp = {},
|
||||
|
||||
@@ -245,7 +245,7 @@ TEST_F(TestTypeSystemClang, TestBuiltinTypeForEmptyTriple) {
|
||||
|
||||
EXPECT_FALSE(ast.GetBuiltinTypeByName(ConstString("int")).IsValid());
|
||||
EXPECT_FALSE(ast.GetBuiltinTypeForDWARFEncodingAndBitSize(
|
||||
"char", dwarf::DW_ATE_signed_char, 8)
|
||||
"char", llvm::dwarf::DW_ATE_signed_char, 8)
|
||||
.IsValid());
|
||||
EXPECT_FALSE(ast.GetBuiltinTypeForEncodingAndBitSize(lldb::eEncodingUint, 8)
|
||||
.IsValid());
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "TestingSupport/Symbol/YAMLModuleTester.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
TEST(DWARF64UnitTest, DWARF64DebugInfoAndCU) {
|
||||
const char *yamldata = R"(
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
namespace {
|
||||
static std::once_flag debugger_initialize_flag;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
|
||||
TEST(DWARFDIETest, ChildIteration) {
|
||||
// Tests DWARFDIE::child_iterator.
|
||||
|
||||
@@ -34,7 +34,7 @@ check_num_matches(DebugNamesDWARFIndex &index, int expected_num_matches,
|
||||
}
|
||||
|
||||
static DWARFDeclContext::Entry make_entry(const char *c) {
|
||||
return DWARFDeclContext::Entry(dwarf::DW_TAG_class_type, c);
|
||||
return DWARFDeclContext::Entry(llvm::dwarf::DW_TAG_class_type, c);
|
||||
}
|
||||
|
||||
TEST(DWARFDebugNamesIndexTest, FullyQualifiedQueryWithIDXParent) {
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::dwarf;
|
||||
using namespace lldb_private::plugin::dwarf;
|
||||
using namespace llvm::dwarf;
|
||||
using llvm::DWARFDebugArangeSet;
|
||||
|
||||
class SymbolFileDWARFTests : public testing::Test {
|
||||
|
||||
Reference in New Issue
Block a user