1 //===-- Declaration.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/Declaration.h"
11 #include "lldb/Core/Stream.h"
13 using namespace lldb_private;
16 Declaration::Dump(Stream *s, bool show_fullpaths) const
24 *s << m_file.GetFilename();
26 s->Printf(":%u", m_line);
27 #ifdef LLDB_ENABLE_DECLARATION_COLUMNS
29 s->Printf(":%u", m_column);
36 s->Printf(", line = %u", m_line);
37 #ifdef LLDB_ENABLE_DECLARATION_COLUMNS
39 s->Printf(":%u", m_column);
42 #ifdef LLDB_ENABLE_DECLARATION_COLUMNS
43 else if (m_column > 0)
44 s->Printf(", column = %u", m_column);
50 Declaration::DumpStopContext (Stream *s, bool show_fullpaths) const
54 if (show_fullpaths || s->GetVerbose())
57 m_file.GetFilename().Dump(s);
60 s->Printf(":%u", m_line);
61 #ifdef LLDB_ENABLE_DECLARATION_COLUMNS
63 s->Printf(":%u", m_column);
69 s->Printf(" line %u", m_line);
70 #ifdef LLDB_ENABLE_DECLARATION_COLUMNS
72 s->Printf(":%u", m_column);
80 Declaration::MemorySize() const
82 return sizeof(Declaration);
86 Declaration::Compare(const Declaration& a, const Declaration& b)
88 int result = FileSpec::Compare(a.m_file, b.m_file, true);
91 if (a.m_line < b.m_line)
93 else if (a.m_line > b.m_line)
95 #ifdef LLDB_ENABLE_DECLARATION_COLUMNS
96 if (a.m_column < b.m_column)
98 else if (a.m_column > b.m_column)
105 lldb_private::operator == (const Declaration &lhs, const Declaration &rhs)
107 #ifdef LLDB_ENABLE_DECLARATION_COLUMNS
108 if (lhs.GetColumn () == rhs.GetColumn ())
109 if (lhs.GetLine () == rhs.GetLine ())
110 return lhs.GetFile() == rhs.GetFile();
112 if (lhs.GetLine () == rhs.GetLine ())
113 return lhs.GetFile() == rhs.GetFile();