1 //===-- DebugMacros.cpp -----------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "lldb/Symbol/DebugMacros.h"
12 #include "lldb/Symbol/CompileUnit.h"
14 using namespace lldb_private;
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),
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) {}
26 const FileSpec &DebugMacroEntry::GetFileSpec(CompileUnit *comp_unit) const {
27 return comp_unit->GetSupportFiles().GetFileSpecAtIndex(m_debug_line_file_idx);
30 DebugMacroEntry DebugMacroEntry::CreateDefineEntry(uint32_t line,
32 return DebugMacroEntry(DebugMacroEntry::DEFINE, line, 0, str);
35 DebugMacroEntry DebugMacroEntry::CreateUndefEntry(uint32_t line,
37 return DebugMacroEntry(DebugMacroEntry::UNDEF, line, 0, str);
41 DebugMacroEntry::CreateStartFileEntry(uint32_t line,
42 uint32_t debug_line_file_idx) {
43 return DebugMacroEntry(DebugMacroEntry::START_FILE, line, debug_line_file_idx,
47 DebugMacroEntry DebugMacroEntry::CreateEndFileEntry() {
48 return DebugMacroEntry(DebugMacroEntry::END_FILE, 0, 0, nullptr);
52 DebugMacroEntry::CreateIndirectEntry(const DebugMacrosSP &debug_macros_sp) {
53 return DebugMacroEntry(DebugMacroEntry::INDIRECT, debug_macros_sp);