]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - source/Symbol/DebugMacros.cpp
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / source / Symbol / DebugMacros.cpp
1 //===-- DebugMacros.cpp -----------------------------------------*- 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 #include "lldb/Symbol/DebugMacros.h"
11
12 #include "lldb/Symbol/CompileUnit.h"
13
14 using namespace lldb_private;
15
16 DebugMacroEntry::DebugMacroEntry(EntryType type, uint32_t line,
17                                  uint32_t debug_line_file_idx, const char *str)
18     : m_type(type), m_line(line), m_debug_line_file_idx(debug_line_file_idx),
19       m_str(str) {}
20
21 DebugMacroEntry::DebugMacroEntry(EntryType type,
22                                  const DebugMacrosSP &debug_macros_sp)
23     : m_type(type), m_line(0), m_debug_line_file_idx(0),
24       m_debug_macros_sp(debug_macros_sp) {}
25
26 const FileSpec &DebugMacroEntry::GetFileSpec(CompileUnit *comp_unit) const {
27   return comp_unit->GetSupportFiles().GetFileSpecAtIndex(m_debug_line_file_idx);
28 }
29
30 DebugMacroEntry DebugMacroEntry::CreateDefineEntry(uint32_t line,
31                                                    const char *str) {
32   return DebugMacroEntry(DebugMacroEntry::DEFINE, line, 0, str);
33 }
34
35 DebugMacroEntry DebugMacroEntry::CreateUndefEntry(uint32_t line,
36                                                   const char *str) {
37   return DebugMacroEntry(DebugMacroEntry::UNDEF, line, 0, str);
38 }
39
40 DebugMacroEntry
41 DebugMacroEntry::CreateStartFileEntry(uint32_t line,
42                                       uint32_t debug_line_file_idx) {
43   return DebugMacroEntry(DebugMacroEntry::START_FILE, line, debug_line_file_idx,
44                          nullptr);
45 }
46
47 DebugMacroEntry DebugMacroEntry::CreateEndFileEntry() {
48   return DebugMacroEntry(DebugMacroEntry::END_FILE, 0, 0, nullptr);
49 }
50
51 DebugMacroEntry
52 DebugMacroEntry::CreateIndirectEntry(const DebugMacrosSP &debug_macros_sp) {
53   return DebugMacroEntry(DebugMacroEntry::INDIRECT, debug_macros_sp);
54 }