1 //===-- DIERef.cpp ----------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "DIERef.h" 10 #include "DWARFUnit.h" 11 #include "DWARFDebugInfo.h" 12 #include "DWARFFormValue.h" 13 #include "SymbolFileDWARF.h" 14 #include "SymbolFileDWARFDebugMap.h" 15 16 DIERef::DIERef(const DWARFFormValue &form_value) { 17 if (form_value.IsValid()) { 18 DWARFDIE die = form_value.Reference(); 19 die_offset = die.GetOffset(); 20 if (die) { 21 section = die.GetCU()->GetDebugSection(); 22 if (die.GetCU()->GetBaseObjOffset() != DW_INVALID_OFFSET) 23 cu_offset = die.GetCU()->GetBaseObjOffset(); 24 else 25 cu_offset = die.GetCU()->GetOffset(); 26 } 27 } 28 } 29