1 //===-- DIERef.h ------------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef SymbolFileDWARF_DIERef_h_
11 #define SymbolFileDWARF_DIERef_h_
12 
13 #include "lldb/Core/dwarf.h"
14 #include "lldb/lldb-defines.h"
15 
16 class DWARFFormValue;
17 class SymbolFileDWARF;
18 
19 struct DIERef
20 {
21     DIERef();
22 
23     DIERef(dw_offset_t c, dw_offset_t d);
24 
25     //----------------------------------------------------------------------
26     // In order to properly decode a lldb::user_id_t back into a DIERef we
27     // need the DWARF file since it knows if DWARF in .o files is being used
28     // (MacOSX) or if DWO files are being used. The encoding of the user ID
29     // differs between the two types of DWARF.
30     //----------------------------------------------------------------------
31     explicit
32     DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf);
33 
34     explicit
35     DIERef(const DWARFFormValue& form_value);
36 
37     //----------------------------------------------------------------------
38     // In order to properly encode a DIERef unto a lldb::user_id_t we need
39     // the DWARF file since it knows if DWARF in .o files is being used
40     // (MacOSX) or if DWO files are being used. The encoding of the user ID
41     // differs between the two types of DWARF.
42     //----------------------------------------------------------------------
43     lldb::user_id_t
44     GetUID(SymbolFileDWARF *dwarf) const;
45 
46     bool
47     operator< (const DIERef &ref) const
48     {
49         return die_offset < ref.die_offset;
50     }
51 
52     bool
53     operator< (const DIERef &ref)
54     {
55         return die_offset < ref.die_offset;
56     }
57 
58     dw_offset_t cu_offset;
59     dw_offset_t die_offset;
60 };
61 
62 typedef std::vector<DIERef> DIEArray;
63 
64 #endif  // SymbolFileDWARF_DIERef_h_
65