llvm-6502/unittests/IR
Duncan P. N. Exon Smith 2ebd1efc08 IR: Make MDNode::dump() useful by adding addresses
It's horrible to inspect `MDNode`s in a debugger.  All of their operands
that are `MDNode`s get dumped as `<badref>`, since we can't assign
metadata slots in the context of a `Metadata::dump()`.  (Why not?  Why
not assign numbers lazily?  Because then each time you called `dump()`,
a given `MDNode` could have a different lazily assigned number.)

Fortunately, the C memory model gives us perfectly good identifiers for
`MDNode`.  Add pointer addresses to the dumps, transforming this:

    (lldb) e N->dump()
    !{i32 662302, i32 26, <badref>, null}

    (lldb) e ((MDNode*)N->getOperand(2))->dump()
    !{i32 4, !"foo"}

into:

    (lldb) e N->dump()
    !{i32 662302, i32 26, <0x100706ee0>, null}

    (lldb) e ((MDNode*)0x100706ee0)->dump()
    !{i32 4, !"foo"}

and this:

    (lldb) e N->dump()
    0x101200248 = !{<badref>, <badref>, <badref>, <badref>, <badref>}

    (lldb) e N->getOperand(0)
    (const llvm::MDOperand) $0 = {
      MD = 0x00000001012004e0
    }
    (lldb) e N->getOperand(1)
    (const llvm::MDOperand) $1 = {
      MD = 0x00000001012004e0
    }
    (lldb) e N->getOperand(2)
    (const llvm::MDOperand) $2 = {
      MD = 0x0000000101200058
    }
    (lldb) e N->getOperand(3)
    (const llvm::MDOperand) $3 = {
      MD = 0x00000001012004e0
    }
    (lldb) e N->getOperand(4)
    (const llvm::MDOperand) $4 = {
      MD = 0x0000000101200058
    }
    (lldb) e ((MDNode*)0x00000001012004e0)->dump()
    !{}

    (lldb) e ((MDNode*)0x0000000101200058)->dump()
    !{null}

into:

    (lldb) e N->dump()
    !{<0x1012004e0>, <0x1012004e0>, <0x101200058>, <0x1012004e0>, <0x101200058>}

    (lldb) e ((MDNode*)0x1012004e0)->dump()
    !{}

    (lldb) e ((MDNode*)0x101200058)->dump()
    !{null}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224325 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-16 07:09:37 +00:00
..
AttributesTest.cpp Make one of the AttributeSet ctors maintain the invariant that the 2013-08-02 22:29:40 +00:00
CMakeLists.txt Revert "Revert "DI: Fold constant arguments into a single MDString"" 2014-10-03 20:01:09 +00:00
ConstantRangeTest.cpp
ConstantsTest.cpp IR: Fix a missed case when threading OnlyIfReduced through ConstantExpr 2014-08-19 21:18:21 +00:00
DebugInfoTest.cpp Silence a -Wcast-qual warning; NFC. 2014-10-21 16:12:37 +00:00
DominatorTreeTest.cpp Modernize the .ll parsing interface. 2014-08-19 16:58:54 +00:00
InstructionsTest.cpp
IRBuilderTest.cpp Fix a logic bug when copying fast-math flags. 2014-09-02 20:03:00 +00:00
LeakDetectorTest.cpp [Modules] Move the LeakDetector header into the IR library where the 2014-03-04 12:46:06 +00:00
LegacyPassManagerTest.cpp Add doInitialization/doFinalization to DataLayoutPass. 2014-09-10 21:27:43 +00:00
Makefile
MDBuilderTest.cpp IR: Split Metadata from Value 2014-12-09 18:38:53 +00:00
MetadataTest.cpp IR: Make MDNode::dump() useful by adding addresses 2014-12-16 07:09:37 +00:00
PassManagerTest.cpp Modernize the .ll parsing interface. 2014-08-19 16:58:54 +00:00
PatternMatch.cpp
TypeBuilderTest.cpp
TypesTest.cpp
UserTest.cpp Modernize the .ll parsing interface. 2014-08-19 16:58:54 +00:00
UseTest.cpp Modernize the .ll parsing interface. 2014-08-19 16:58:54 +00:00
ValueHandleTest.cpp
ValueMapTest.cpp Support: make LLVM Mutexes STL-compatible 2014-08-23 22:49:22 +00:00
ValueTest.cpp Add unittest for extreme alignments. 2014-10-23 14:45:19 +00:00
VerifierTest.cpp
WaymarkTest.cpp [C++11] Use 'nullptr'. 2014-06-08 22:29:17 +00:00