llvm-project/lldb/source/Symbol/Declaration.cpp
Pavel Labath 0cfd7dc9ea Remove a couple of Stream flags
Summary:
I came across this while trying to understand what Log::Debug does. It turns out
it does not do anything, as there is no instance of someone setting a debug flag
on a stream. The same is true for the Verbose and AddPrefix flags. Removing
these will enable some cleanups in the Logging class, and it brings us closer
towards the long term goal of standardizing on llvm stream classes.

I have removed these flags and all code the code which tested for their
presence -- there wasn't much of it, mostly in SymbolFileDWARF, which is
probably going away at some point anyway.

The eBinary flag still has some users, so I am letting it life for the time
being.

Reviewers: clayborg, zturner

Subscribers: aprantl, beanz, lldb-commits

Differential Revision: https://reviews.llvm.org/D28616

llvm-svn: 291895
2017-01-13 10:41:59 +00:00

98 lines
2.5 KiB
C++

//===-- Declaration.cpp -----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/Declaration.h"
#include "lldb/Core/Stream.h"
using namespace lldb_private;
void Declaration::Dump(Stream *s, bool show_fullpaths) const {
if (m_file) {
*s << ", decl = ";
if (show_fullpaths)
*s << m_file;
else
*s << m_file.GetFilename();
if (m_line > 0)
s->Printf(":%u", m_line);
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
if (m_column > 0)
s->Printf(":%u", m_column);
#endif
} else {
if (m_line > 0) {
s->Printf(", line = %u", m_line);
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
if (m_column > 0)
s->Printf(":%u", m_column);
#endif
}
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
else if (m_column > 0)
s->Printf(", column = %u", m_column);
#endif
}
}
bool Declaration::DumpStopContext(Stream *s, bool show_fullpaths) const {
if (m_file) {
if (show_fullpaths)
*s << m_file;
else
m_file.GetFilename().Dump(s);
if (m_line > 0)
s->Printf(":%u", m_line);
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
if (m_column > 0)
s->Printf(":%u", m_column);
#endif
return true;
} else if (m_line > 0) {
s->Printf(" line %u", m_line);
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
if (m_column > 0)
s->Printf(":%u", m_column);
#endif
return true;
}
return false;
}
size_t Declaration::MemorySize() const { return sizeof(Declaration); }
int Declaration::Compare(const Declaration &a, const Declaration &b) {
int result = FileSpec::Compare(a.m_file, b.m_file, true);
if (result)
return result;
if (a.m_line < b.m_line)
return -1;
else if (a.m_line > b.m_line)
return 1;
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
if (a.m_column < b.m_column)
return -1;
else if (a.m_column > b.m_column)
return 1;
#endif
return 0;
}
bool lldb_private::operator==(const Declaration &lhs, const Declaration &rhs) {
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
if (lhs.GetColumn() == rhs.GetColumn())
if (lhs.GetLine() == rhs.GetLine())
return lhs.GetFile() == rhs.GetFile();
#else
if (lhs.GetLine() == rhs.GetLine())
return FileSpec::Equal(lhs.GetFile(), rhs.GetFile(), true, true);
#endif
return false;
}