Also print structs; add test.

This commit is contained in:
Axel Naumann
2014-08-14 14:13:40 +02:00
committed by sftnight
parent deb155f20a
commit 11d315a22b
2 changed files with 8 additions and 2 deletions

View File

@ -404,8 +404,8 @@ namespace valuePrinterInternal {
|| Ty->isArrayType()) || Ty->isArrayType())
StreamValue(o, V.getPtr(), Ty, Interp); StreamValue(o, V.getPtr(), Ty, Interp);
else { else {
assert(0 && "I don't know what I am printing."); // struct case.
StreamValue(o, &V, Ty, Interp); StreamValue(o, V.getPtr(), Ty, Interp);
} }
} }

View File

@ -22,6 +22,7 @@ public:
}; };
const A& foo(const A& arg) { return arg; } const A& foo(const A& arg) { return arg; }
A foo2(const A& arg) { return A(42); }
.rawInput 0 .rawInput 0
foo(A(12)).Var foo(A(12)).Var
@ -29,6 +30,11 @@ foo(A(12)).Var
// CHECK: A d'tor // CHECK: A d'tor
// End PR #93006 // End PR #93006
// myvector.end() failed to print (roottest/cling/stl/default/VectorSort.C)
foo2(A(42))
// CHECK: (A) @0x{{[0-9a-f]+}}
// CHECK: A d'tor
// Savannah #96523 // Savannah #96523
int *p = (int*)0x123; int *p = (int*)0x123;
p // CHECK: (int *) 0x123 p // CHECK: (int *) 0x123