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_SBCompileUnit_h_
10 #define LLDB_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(uint32_t start_idx, uint32_t line,
38                               lldb::SBFileSpec *inline_file_spec) const;
39 
40   uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
41                               lldb::SBFileSpec *inline_file_spec,
42                               bool exact) const;
43 
44   SBFileSpec GetSupportFileAtIndex(uint32_t idx) const;
45 
46   uint32_t GetNumSupportFiles() const;
47 
48   uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file,
49                                 bool full);
50 
51   /// Get all types matching \a type_mask from debug info in this
52   /// compile unit.
53   ///
54   /// \param[in] type_mask
55   ///    A bitfield that consists of one or more bits logically OR'ed
56   ///    together from the lldb::TypeClass enumeration. This allows
57   ///    you to request only structure types, or only class, struct
58   ///    and union types. Passing in lldb::eTypeClassAny will return
59   ///    all types found in the debug information for this compile
60   ///    unit.
61   ///
62   /// \return
63   ///    A list of types in this compile unit that match \a type_mask
64   lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
65 
66   lldb::LanguageType GetLanguage();
67 
68   bool operator==(const lldb::SBCompileUnit &rhs) const;
69 
70   bool operator!=(const lldb::SBCompileUnit &rhs) const;
71 
72   bool GetDescription(lldb::SBStream &description);
73 
74 private:
75   friend class SBAddress;
76   friend class SBFrame;
77   friend class SBSymbolContext;
78   friend class SBModule;
79 
80   SBCompileUnit(lldb_private::CompileUnit *lldb_object_ptr);
81 
82   const lldb_private::CompileUnit *operator->() const;
83 
84   const lldb_private::CompileUnit &operator*() const;
85 
86   lldb_private::CompileUnit *get();
87 
88   void reset(lldb_private::CompileUnit *lldb_object_ptr);
89 
90   lldb_private::CompileUnit *m_opaque_ptr;
91 };
92 
93 } // namespace lldb
94 
95 #endif // LLDB_SBCompileUnit_h_
96