*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
73 lines
2.4 KiB
C++
73 lines
2.4 KiB
C++
//===-- DIERef.cpp ----------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "DIERef.h"
|
|
#include "DWARFCompileUnit.h"
|
|
#include "DWARFDebugInfo.h"
|
|
#include "DWARFFormValue.h"
|
|
#include "SymbolFileDWARF.h"
|
|
#include "SymbolFileDWARFDebugMap.h"
|
|
|
|
DIERef::DIERef()
|
|
: cu_offset(DW_INVALID_OFFSET), die_offset(DW_INVALID_OFFSET) {}
|
|
|
|
DIERef::DIERef(dw_offset_t c, dw_offset_t d) : cu_offset(c), die_offset(d) {}
|
|
|
|
DIERef::DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf)
|
|
: cu_offset(DW_INVALID_OFFSET), die_offset(uid & 0xffffffff) {
|
|
SymbolFileDWARFDebugMap *debug_map = dwarf->GetDebugMapSymfile();
|
|
if (debug_map) {
|
|
const uint32_t oso_idx = debug_map->GetOSOIndexFromUserID(uid);
|
|
SymbolFileDWARF *actual_dwarf = debug_map->GetSymbolFileByOSOIndex(oso_idx);
|
|
if (actual_dwarf) {
|
|
DWARFDebugInfo *debug_info = actual_dwarf->DebugInfo();
|
|
if (debug_info) {
|
|
DWARFCompileUnit *dwarf_cu =
|
|
debug_info->GetCompileUnitContainingDIEOffset(die_offset);
|
|
if (dwarf_cu) {
|
|
cu_offset = dwarf_cu->GetOffset();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
die_offset = DW_INVALID_OFFSET;
|
|
} else {
|
|
cu_offset = uid >> 32;
|
|
}
|
|
}
|
|
|
|
DIERef::DIERef(const DWARFFormValue &form_value)
|
|
: cu_offset(DW_INVALID_OFFSET), die_offset(DW_INVALID_OFFSET) {
|
|
if (form_value.IsValid()) {
|
|
const DWARFCompileUnit *dwarf_cu = form_value.GetCompileUnit();
|
|
if (dwarf_cu) {
|
|
if (dwarf_cu->GetBaseObjOffset() != DW_INVALID_OFFSET)
|
|
cu_offset = dwarf_cu->GetBaseObjOffset();
|
|
else
|
|
cu_offset = dwarf_cu->GetOffset();
|
|
}
|
|
die_offset = form_value.Reference();
|
|
}
|
|
}
|
|
|
|
lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const {
|
|
//----------------------------------------------------------------------
|
|
// Each SymbolFileDWARF will set its ID to what is expected.
|
|
//
|
|
// SymbolFileDWARF, when used for DWARF with .o files on MacOSX, has the
|
|
// ID set to the compile unit index.
|
|
//
|
|
// SymbolFileDWARFDwo sets the ID to the compile unit offset.
|
|
//----------------------------------------------------------------------
|
|
if (dwarf)
|
|
return dwarf->GetID() | die_offset;
|
|
else
|
|
return LLDB_INVALID_UID;
|
|
}
|