First Last Prev Next    No search results available
Details
: Sending a Value* to an ostream should print its address, ...
Bug#: 341
: libraries
: Core LLVM classes
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P2
: enhancement
: 1.3

:
: code-cleanup
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2004-05-19 12:40
Vikram pointed out this inconsistency long ago, but it still remains:

  Value *X = ...
  std::cout << "Addr: " << X << "  Contents: " << *X;

Both of these print out the *contents* of X.  The only way to print the address
of a Value* is currently to cast it to a void* like this:

  std::cout << "Addr: " << (void*)X << "  Contents: " << *X;

Ick.

Changing this should be quite simple, but the problem is that it will probably
break a lot of code that is still relying on printing of addresses to print the
contents of the value.

The best way to fix this is probably to change operator<< for Value*'s to be a
template that causes a compile time problem when used.  Once this happens, the
compiler will identify where it's being used, and all uses can be switched over
to using the reference printing version.  Once the sourcebase is checked, the
template can be removed.

-Chris
------- Comment #1 From Chris Lattner 2004-07-14 21:40:35 -------
mine
------- Comment #2 From Chris Lattner 2004-07-14 21:56:13 -------
This bug is now fixed.  There were many patches, but this is the one that
matters:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040712/016026.html

std::cerr << Value* will now print he address of the object, not its contents.

-Chris

First Last Prev Next    No search results available