summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2015-07-22 07:58:17 +0000
committerPavel Labath <labath@google.com>2015-07-22 07:58:17 +0000
commitc2f33f6754ca689e609abe8e8cb33477e7a01b4e (patch)
treea249f14cb319d613034425fb2532dd432effe047
parentc0f3a158f0cd7cbcb8ea83ba2056be32d97a2fa5 (diff)
downloadbcm5719-llvm-c2f33f6754ca689e609abe8e8cb33477e7a01b4e.tar.gz
bcm5719-llvm-c2f33f6754ca689e609abe8e8cb33477e7a01b4e.zip
Make stream::operator<< take "const" void *
Summary: This enables us to avoid casts to "void *" in some cases and avoids a couple of "casts off const qualifiers" warnings. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D11388 llvm-svn: 242874
-rw-r--r--lldb/include/lldb/Core/Stream.h2
-rw-r--r--lldb/source/Core/Stream.cpp4
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp16
3 files changed, 11 insertions, 11 deletions
diff --git a/lldb/include/lldb/Core/Stream.h b/lldb/include/lldb/Core/Stream.h
index 11780aa6ff0..7a8ca1c8cfc 100644
--- a/lldb/include/lldb/Core/Stream.h
+++ b/lldb/include/lldb/Core/Stream.h
@@ -221,7 +221,7 @@ public:
/// in one statement.
//------------------------------------------------------------------
Stream&
- operator<< (void *p);
+ operator<< (const void *p);
//------------------------------------------------------------------
/// Output a character \a ch to the stream \a s.
diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp
index 29bebb3ae3d..b3d1a359e8e 100644
--- a/lldb/source/Core/Stream.cpp
+++ b/lldb/source/Core/Stream.cpp
@@ -284,9 +284,9 @@ Stream::operator<< (const char *s)
// Stream the pointer value out to this stream.
//------------------------------------------------------------------
Stream&
-Stream::operator<< (void *p)
+Stream::operator<< (const void *p)
{
- Printf ("0x%.*tx", (int)sizeof(void*) * 2, (ptrdiff_t)p);
+ Printf ("0x%.*tx", (int)sizeof(const void*) * 2, (ptrdiff_t)p);
return *this;
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 4fb0dbc237c..19b460c313f 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -391,24 +391,24 @@ SymbolContext::GetResolvedMask () const
void
SymbolContext::Dump(Stream *s, Target *target) const
{
- *s << (void *)this << ": ";
+ *s << this << ": ";
s->Indent();
s->PutCString("SymbolContext");
s->IndentMore();
s->EOL();
s->IndentMore();
s->Indent();
- *s << "Module = " << (void *)module_sp.get() << ' ';
+ *s << "Module = " << module_sp.get() << ' ';
if (module_sp)
module_sp->GetFileSpec().Dump(s);
s->EOL();
s->Indent();
- *s << "CompileUnit = " << (void *)comp_unit;
+ *s << "CompileUnit = " << comp_unit;
if (comp_unit != nullptr)
*s << " {0x" << comp_unit->GetID() << "} " << *(static_cast<FileSpec*> (comp_unit));
s->EOL();
s->Indent();
- *s << "Function = " << (void *)function;
+ *s << "Function = " << function;
if (function != nullptr)
{
*s << " {0x" << function->GetID() << "} " << function->GetType()->GetName() << ", address-range = ";
@@ -424,7 +424,7 @@ SymbolContext::Dump(Stream *s, Target *target) const
}
s->EOL();
s->Indent();
- *s << "Block = " << (void *)block;
+ *s << "Block = " << block;
if (block != nullptr)
*s << " {0x" << block->GetID() << '}';
// Dump the block and pass it a negative depth to we print all the parent blocks
@@ -436,11 +436,11 @@ SymbolContext::Dump(Stream *s, Target *target) const
line_entry.Dump (s, target, true, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, true);
s->EOL();
s->Indent();
- *s << "Symbol = " << (void *)symbol;
+ *s << "Symbol = " << symbol;
if (symbol != nullptr && symbol->GetMangled())
*s << ' ' << symbol->GetName().AsCString();
s->EOL();
- *s << "Variable = " << (void *)variable;
+ *s << "Variable = " << variable;
if (variable != nullptr)
{
*s << " {0x" << variable->GetID() << "} " << variable->GetType()->GetName();
@@ -1178,7 +1178,7 @@ void
SymbolContextList::Dump(Stream *s, Target *target) const
{
- *s << (void *)this << ": ";
+ *s << this << ": ";
s->Indent();
s->PutCString("SymbolContextList");
s->EOL();
OpenPOWER on IntegriCloud