1 //===-- SBCompileUnit.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 LLDB_API_SBCOMPILEUNIT_H
10 #define LLDB_API_SBCOMPILEUNIT_H
11 
12 #include "lldb/API/SBDefines.h"
13 #include "lldb/API/SBFileSpec.h"
14 
15 namespace lldb {
16 
17 class LLDB_API SBCompileUnit {
18 public:
19   SBCompileUnit();
20 
21   SBCompileUnit(const lldb::SBCompileUnit &rhs);
22 
23   ~SBCompileUnit();
24 
25   const lldb::SBCompileUnit &operator=(const lldb::SBCompileUnit &rhs);
26 
27   explicit operator bool() const;
28 
29   bool IsValid() const;
30 
31   lldb::SBFileSpec GetFileSpec() const;
32 
33   uint32_t GetNumLineEntries() const;
34 
35   lldb::SBLineEntry GetLineEntryAtIndex(uint32_t idx) const;
36 
37   uint32_t FindLineEntryIndex(lldb::SBLineEntry &line_entry,
38                               bool exact = false) const;
39 
40   uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
41                               lldb::SBFileSpec *inline_file_spec) const;
42 
43   uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
44                               lldb::SBFileSpec *inline_file_spec,
45                               bool exact) const;
46 
47   SBFileSpec GetSupportFileAtIndex(uint32_t idx) const;
48 
49   uint32_t GetNumSupportFiles() const;
50 
51   uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file,
52                                 bool full);
53 
54   /// Get all types matching \a type_mask from debug info in this
55   /// compile unit.
56   ///
57   /// \param[in] type_mask
58   ///    A bitfield that consists of one or more bits logically OR'ed
59   ///    together from the lldb::TypeClass enumeration. This allows
60   ///    you to request only structure types, or only class, struct
61   ///    and union types. Passing in lldb::eTypeClassAny will return
62   ///    all types found in the debug information for this compile
63   ///    unit.
64   ///
65   /// \return
66   ///    A list of types in this compile unit that match \a type_mask
67   lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
68 
69   lldb::LanguageType GetLanguage();
70 
71   bool operator==(const lldb::SBCompileUnit &rhs) const;
72 
73   bool operator!=(const lldb::SBCompileUnit &rhs) const;
74 
75   bool GetDescription(lldb::SBStream &description);
76 
77 private:
78   friend class SBAddress;
79   friend class SBFrame;
80   friend class SBSymbolContext;
81   friend class SBModule;
82 
83   SBCompileUnit(lldb_private::CompileUnit *lldb_object_ptr);
84 
85   const lldb_private::CompileUnit *operator->() const;
86 
87   const lldb_private::CompileUnit &operator*() const;
88 
89   lldb_private::CompileUnit *get();
90 
91   void reset(lldb_private::CompileUnit *lldb_object_ptr);
92 
93   lldb_private::CompileUnit *m_opaque_ptr = nullptr;
94 };
95 
96 } // namespace lldb
97 
98 #endif // LLDB_API_SBCOMPILEUNIT_H
99