[Lldb-commits] [PATCH] D11388: Make stream::operator<< take "const" void *

Pavel Labath labath at google.com
Wed Jul 22 00:58:47 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL242874: Make stream::operator<< take "const" void * (authored by labath).

Changed prior to commit:
  http://reviews.llvm.org/D11388?vs=30250&id=30327#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11388

Files:
  lldb/trunk/include/lldb/Core/Stream.h
  lldb/trunk/source/Core/Stream.cpp
  lldb/trunk/source/Symbol/SymbolContext.cpp

Index: lldb/trunk/include/lldb/Core/Stream.h
===================================================================
--- lldb/trunk/include/lldb/Core/Stream.h
+++ lldb/trunk/include/lldb/Core/Stream.h
@@ -221,7 +221,7 @@
     ///     in one statement.
     //------------------------------------------------------------------
     Stream&
-    operator<< (void *p);
+    operator<< (const void *p);
 
     //------------------------------------------------------------------
     /// Output a character \a ch to the stream \a s.
Index: lldb/trunk/source/Core/Stream.cpp
===================================================================
--- lldb/trunk/source/Core/Stream.cpp
+++ lldb/trunk/source/Core/Stream.cpp
@@ -284,9 +284,9 @@
 // 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;
 }
 
Index: lldb/trunk/source/Symbol/SymbolContext.cpp
===================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp
+++ lldb/trunk/source/Symbol/SymbolContext.cpp
@@ -391,24 +391,24 @@
 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 @@
     }
     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 @@
     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 @@
 SymbolContextList::Dump(Stream *s, Target *target) const
 {
 
-    *s << (void *)this << ": ";
+    *s << this << ": ";
     s->Indent();
     s->PutCString("SymbolContextList");
     s->EOL();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11388.30327.patch
Type: text/x-patch
Size: 3397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150722/33375d56/attachment.bin>


More information about the lldb-commits mailing list