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
This commit is contained in:
Pavel Labath 2015-07-22 07:58:17 +00:00
parent c0f3a158f0
commit c2f33f6754
3 changed files with 11 additions and 11 deletions

View File

@ -221,7 +221,7 @@ public:
/// in one statement. /// in one statement.
//------------------------------------------------------------------ //------------------------------------------------------------------
Stream& Stream&
operator<< (void *p); operator<< (const void *p);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Output a character \a ch to the stream \a s. /// Output a character \a ch to the stream \a s.

View File

@ -284,9 +284,9 @@ Stream::operator<< (const char *s)
// Stream the pointer value out to this stream. // Stream the pointer value out to this stream.
//------------------------------------------------------------------ //------------------------------------------------------------------
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; return *this;
} }

View File

@ -391,24 +391,24 @@ SymbolContext::GetResolvedMask () const
void void
SymbolContext::Dump(Stream *s, Target *target) const SymbolContext::Dump(Stream *s, Target *target) const
{ {
*s << (void *)this << ": "; *s << this << ": ";
s->Indent(); s->Indent();
s->PutCString("SymbolContext"); s->PutCString("SymbolContext");
s->IndentMore(); s->IndentMore();
s->EOL(); s->EOL();
s->IndentMore(); s->IndentMore();
s->Indent(); s->Indent();
*s << "Module = " << (void *)module_sp.get() << ' '; *s << "Module = " << module_sp.get() << ' ';
if (module_sp) if (module_sp)
module_sp->GetFileSpec().Dump(s); module_sp->GetFileSpec().Dump(s);
s->EOL(); s->EOL();
s->Indent(); s->Indent();
*s << "CompileUnit = " << (void *)comp_unit; *s << "CompileUnit = " << comp_unit;
if (comp_unit != nullptr) if (comp_unit != nullptr)
*s << " {0x" << comp_unit->GetID() << "} " << *(static_cast<FileSpec*> (comp_unit)); *s << " {0x" << comp_unit->GetID() << "} " << *(static_cast<FileSpec*> (comp_unit));
s->EOL(); s->EOL();
s->Indent(); s->Indent();
*s << "Function = " << (void *)function; *s << "Function = " << function;
if (function != nullptr) if (function != nullptr)
{ {
*s << " {0x" << function->GetID() << "} " << function->GetType()->GetName() << ", address-range = "; *s << " {0x" << function->GetID() << "} " << function->GetType()->GetName() << ", address-range = ";
@ -424,7 +424,7 @@ SymbolContext::Dump(Stream *s, Target *target) const
} }
s->EOL(); s->EOL();
s->Indent(); s->Indent();
*s << "Block = " << (void *)block; *s << "Block = " << block;
if (block != nullptr) if (block != nullptr)
*s << " {0x" << block->GetID() << '}'; *s << " {0x" << block->GetID() << '}';
// Dump the block and pass it a negative depth to we print all the parent blocks // 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); line_entry.Dump (s, target, true, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress, true);
s->EOL(); s->EOL();
s->Indent(); s->Indent();
*s << "Symbol = " << (void *)symbol; *s << "Symbol = " << symbol;
if (symbol != nullptr && symbol->GetMangled()) if (symbol != nullptr && symbol->GetMangled())
*s << ' ' << symbol->GetName().AsCString(); *s << ' ' << symbol->GetName().AsCString();
s->EOL(); s->EOL();
*s << "Variable = " << (void *)variable; *s << "Variable = " << variable;
if (variable != nullptr) if (variable != nullptr)
{ {
*s << " {0x" << variable->GetID() << "} " << variable->GetType()->GetName(); *s << " {0x" << variable->GetID() << "} " << variable->GetType()->GetName();
@ -1178,7 +1178,7 @@ void
SymbolContextList::Dump(Stream *s, Target *target) const SymbolContextList::Dump(Stream *s, Target *target) const
{ {
*s << (void *)this << ": "; *s << this << ": ";
s->Indent(); s->Indent();
s->PutCString("SymbolContextList"); s->PutCString("SymbolContextList");
s->EOL(); s->EOL();