1 //===-- SBCompileUnit.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 LLDB_SBCompileUnit_h_
11 #define LLDB_SBCompileUnit_h_
12 
13 #include "lldb/API/SBDefines.h"
14 #include "lldb/API/SBFileSpec.h"
15 
16 namespace lldb {
17 
18 class LLDB_API SBCompileUnit {
19 public:
20   SBCompileUnit();
21 
22   SBCompileUnit(const lldb::SBCompileUnit &rhs);
23 
24   ~SBCompileUnit();
25 
26   const lldb::SBCompileUnit &operator=(const lldb::SBCompileUnit &rhs);
27 
28   bool IsValid() const;
29 
30   lldb::SBFileSpec GetFileSpec() const;
31 
32   uint32_t GetNumLineEntries() const;
33 
34   lldb::SBLineEntry GetLineEntryAtIndex(uint32_t idx) const;
35 
36   uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
37                               lldb::SBFileSpec *inline_file_spec) const;
38 
39   uint32_t FindLineEntryIndex(uint32_t start_idx, uint32_t line,
40                               lldb::SBFileSpec *inline_file_spec,
41                               bool exact) const;
42 
43   SBFileSpec GetSupportFileAtIndex(uint32_t idx) const;
44 
45   uint32_t GetNumSupportFiles() const;
46 
47   uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file,
48                                 bool full);
49 
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   //------------------------------------------------------------------
65   lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
66 
67   lldb::LanguageType GetLanguage();
68 
69   bool operator==(const lldb::SBCompileUnit &rhs) const;
70 
71   bool operator!=(const lldb::SBCompileUnit &rhs) const;
72 
73   bool GetDescription(lldb::SBStream &description);
74 
75 private:
76   friend class SBAddress;
77   friend class SBFrame;
78   friend class SBSymbolContext;
79   friend class SBModule;
80 
81   SBCompileUnit(lldb_private::CompileUnit *lldb_object_ptr);
82 
83   const lldb_private::CompileUnit *operator->() const;
84 
85   const lldb_private::CompileUnit &operator*() const;
86 
87   lldb_private::CompileUnit *get();
88 
89   void reset(lldb_private::CompileUnit *lldb_object_ptr);
90 
91   lldb_private::CompileUnit *m_opaque_ptr;
92 };
93 
94 } // namespace lldb
95 
96 #endif // LLDB_SBCompileUnit_h_
97