blob: 9b737e399535c010c3ea07bbd7ab57ff9feca3e3 [file] [log] [blame]
//===-- DIERef.cpp ----------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "DIERef.h"
#include "DWARFUnit.h"
#include "DWARFDebugInfo.h"
#include "DWARFFormValue.h"
#include "SymbolFileDWARF.h"
#include "SymbolFileDWARFDebugMap.h"
DIERef::DIERef(const DWARFFormValue &form_value)
: cu_offset(DW_INVALID_OFFSET), die_offset(DW_INVALID_OFFSET) {
if (form_value.IsValid()) {
DWARFDIE die = form_value.Reference();
die_offset = die.GetOffset();
if (die) {
if (die.GetCU()->GetBaseObjOffset() != DW_INVALID_OFFSET)
cu_offset = die.GetCU()->GetBaseObjOffset();
else
cu_offset = die.GetCU()->GetOffset();
}
}
}