1 //===-- DWARFCompileUnit.h --------------------------------------*- 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 #ifndef SymbolFileDWARF_DWARFCompileUnit_h_
10 #define SymbolFileDWARF_DWARFCompileUnit_h_
11 
12 #include "DWARFUnit.h"
13 #include "llvm/Support/Error.h"
14 
15 class DWARFCompileUnit : public DWARFUnit {
16 public:
17   static llvm::Expected<DWARFUnitSP>
18   extract(SymbolFileDWARF *dwarf2Data,
19           const lldb_private::DWARFDataExtractor &debug_info,
20           lldb::offset_t *offset_ptr);
21   void Dump(lldb_private::Stream *s) const override;
22 
23   //------------------------------------------------------------------
24   /// Get the data that contains the DIE information for this unit.
25   ///
26   /// \return
27   ///   The correct data (.debug_types for DWARF 4 and earlier, and
28   ///   .debug_info for DWARF 5 and later) for the DIE information in
29   ///   this unit.
30   //------------------------------------------------------------------
31   const lldb_private::DWARFDataExtractor &GetData() const override;
32 
33   //------------------------------------------------------------------
34   /// Get the size in bytes of the header.
35   ///
36   /// \return
37   ///     Byte size of the compile unit header
38   //------------------------------------------------------------------
39   uint32_t GetHeaderByteSize() const override;
40 
41 private:
42   DWARFCompileUnit(SymbolFileDWARF *dwarf2Data);
43   DISALLOW_COPY_AND_ASSIGN(DWARFCompileUnit);
44 };
45 
46 #endif // SymbolFileDWARF_DWARFCompileUnit_h_
47